From e7361775c112e32ea517eddc344641897d273d25 Mon Sep 17 00:00:00 2001 From: Eyal Date: Tue, 5 Apr 2016 16:18:56 +0300 Subject: [PATCH] print statment has become a function in py3 Change-Id: Ia616e1fdd4c3fc8e1a36b026e0c3e2a568dc6517 --- tools/generate-devstack-plugins-list.py | 4 ++-- tools/worlddump.py | 31 +++++++++++++------------ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/tools/generate-devstack-plugins-list.py b/tools/generate-devstack-plugins-list.py index aeec4dd27d..089a6ef93e 100644 --- a/tools/generate-devstack-plugins-list.py +++ b/tools/generate-devstack-plugins-list.py @@ -53,7 +53,7 @@ def has_devstack_plugin(proj): if len(r.text) > 0: return True else: - False + return False logging.debug("Getting project list from %s" % url) r = requests.get(url) @@ -64,4 +64,4 @@ found_plugins = filter(has_devstack_plugin, projects) for project in found_plugins: # strip of openstack/ - print project[10:] + print(project[10:]) diff --git a/tools/worlddump.py b/tools/worlddump.py index 345c2a3d94..3d7912a2ec 100755 --- a/tools/worlddump.py +++ b/tools/worlddump.py @@ -14,6 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. + """Dump the state of the world for post mortem.""" import argparse @@ -48,32 +49,32 @@ def filename(dirname, name=""): def warn(msg): - print "WARN: %s" % msg + print("WARN: %s" % msg) def _dump_cmd(cmd): - print cmd - print "-" * len(cmd) - print + print(cmd) + print("-" * len(cmd)) + print() try: subprocess.check_call(cmd, shell=True) - print + print() except subprocess.CalledProcessError as e: - print "*** Failed to run '%(cmd)s': %(err)s" % {'cmd': cmd, 'err': e} + print("*** Failed to run '%(cmd)s': %(err)s" % {'cmd': cmd, 'err': e}) def _find_cmd(cmd): if not spawn.find_executable(cmd): - print "*** %s not found: skipping" % cmd + print("*** %s not found: skipping" % cmd) return False return True def _header(name): - print - print name - print "=" * len(name) - print + print() + print(name) + print("=" * len(name)) + print() # This method gets a max openflow version supported by openvswitch. @@ -109,7 +110,7 @@ def disk_space(): # if it doesn't look like an int, that's fine pass - print dfraw + print(dfraw) def ebtables_dump(): @@ -193,17 +194,17 @@ def guru_meditation_report(): try: subprocess.check_call(["pgrep","nova-compute"]) except subprocess.CalledProcessError: - print "Skipping as nova-compute does not appear to be running" + print("Skipping as nova-compute does not appear to be running") return _dump_cmd("kill -s USR2 `pgrep nova-compute`") - print "guru meditation report in nova-compute log" + print("guru meditation report in nova-compute log") def main(): opts = get_options() fname = filename(opts.dir, opts.name) - print "World dumping... see %s for details" % fname + print("World dumping... see %s for details" % fname) sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) with open(fname, 'w') as f: os.dup2(f.fileno(), sys.stdout.fileno())