Browse code

Merge "print statment has become a function in py3"

Jenkins authored on 2016/04/14 02:17:08
Showing 2 changed files
... ...
@@ -53,7 +53,7 @@ def has_devstack_plugin(proj):
53 53
     if len(r.text) > 0:
54 54
         return True
55 55
     else:
56
-        False
56
+        return False
57 57
 
58 58
 logging.debug("Getting project list from %s" % url)
59 59
 r = requests.get(url)
... ...
@@ -64,4 +64,4 @@ found_plugins = filter(has_devstack_plugin, projects)
64 64
 
65 65
 for project in found_plugins:
66 66
     # strip of openstack/
67
-    print project[10:]
67
+    print(project[10:])
... ...
@@ -14,6 +14,7 @@
14 14
 # License for the specific language governing permissions and limitations
15 15
 # under the License.
16 16
 
17
+
17 18
 """Dump the state of the world for post mortem."""
18 19
 
19 20
 import argparse
... ...
@@ -48,32 +49,32 @@ def filename(dirname, name=""):
48 48
 
49 49
 
50 50
 def warn(msg):
51
-    print "WARN: %s" % msg
51
+    print("WARN: %s" % msg)
52 52
 
53 53
 
54 54
 def _dump_cmd(cmd):
55
-    print cmd
56
-    print "-" * len(cmd)
57
-    print
55
+    print(cmd)
56
+    print("-" * len(cmd))
57
+    print()
58 58
     try:
59 59
         subprocess.check_call(cmd, shell=True)
60
-        print
60
+        print()
61 61
     except subprocess.CalledProcessError as e:
62
-        print "*** Failed to run '%(cmd)s': %(err)s" % {'cmd': cmd, 'err': e}
62
+        print("*** Failed to run '%(cmd)s': %(err)s" % {'cmd': cmd, 'err': e})
63 63
 
64 64
 
65 65
 def _find_cmd(cmd):
66 66
     if not spawn.find_executable(cmd):
67
-        print "*** %s not found: skipping" % cmd
67
+        print("*** %s not found: skipping" % cmd)
68 68
         return False
69 69
     return True
70 70
 
71 71
 
72 72
 def _header(name):
73
-    print
74
-    print name
75
-    print "=" * len(name)
76
-    print
73
+    print()
74
+    print(name)
75
+    print("=" * len(name))
76
+    print()
77 77
 
78 78
 
79 79
 # This method gets a max openflow version supported by openvswitch.
... ...
@@ -109,7 +110,7 @@ def disk_space():
109 109
             # if it doesn't look like an int, that's fine
110 110
             pass
111 111
 
112
-    print dfraw
112
+    print(dfraw)
113 113
 
114 114
 
115 115
 def ebtables_dump():
... ...
@@ -193,17 +194,17 @@ def guru_meditation_report():
193 193
     try:
194 194
         subprocess.check_call(["pgrep","nova-compute"])
195 195
     except subprocess.CalledProcessError:
196
-        print "Skipping as nova-compute does not appear to be running"
196
+        print("Skipping as nova-compute does not appear to be running")
197 197
         return
198 198
 
199 199
     _dump_cmd("kill -s USR2 `pgrep nova-compute`")
200
-    print "guru meditation report in nova-compute log"
200
+    print("guru meditation report in nova-compute log")
201 201
 
202 202
 
203 203
 def main():
204 204
     opts = get_options()
205 205
     fname = filename(opts.dir, opts.name)
206
-    print "World dumping... see %s for details" % fname
206
+    print("World dumping... see %s for details" % fname)
207 207
     sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
208 208
     with open(fname, 'w') as f:
209 209
         os.dup2(f.fileno(), sys.stdout.fileno())