From 4e7b423d3c3137c3f83b71b36279e1a544154833 Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Fri, 13 Apr 2018 09:13:16 -0400 Subject: core/various: python3 compat, prepare for python2 -> python3 see https://review.gluster.org/#/c/19788/ use print fn from __future__ Change-Id: If5075d8d9ca9641058fbc71df8a52aa35804cda4 updates: #411 Signed-off-by: Kaleb S. KEITHLEY --- geo-replication/syncdaemon/__codecheck.py | 3 ++- geo-replication/syncdaemon/argsupgrade.py | 7 ++++--- geo-replication/syncdaemon/gsyncdstatus.py | 5 +++-- geo-replication/syncdaemon/subcmds.py | 7 ++++--- 4 files changed, 13 insertions(+), 9 deletions(-) (limited to 'geo-replication') diff --git a/geo-replication/syncdaemon/__codecheck.py b/geo-replication/syncdaemon/__codecheck.py index 45dbd26bb6..9437147f7d 100644 --- a/geo-replication/syncdaemon/__codecheck.py +++ b/geo-replication/syncdaemon/__codecheck.py @@ -8,6 +8,7 @@ # cases as published by the Free Software Foundation. # +from __future__ import print_function import os import os.path import sys @@ -45,7 +46,7 @@ class IPNetwork(list): gsyncd = sys.modules['gsyncd'] for a in [['--help'], ['--version'], ['--canonicalize-escape-url', '/foo']]: - print('>>> invoking program with args: %s' % ' '.join(a)) + print(('>>> invoking program with args: %s' % ' '.join(a))) pid = os.fork() if not pid: sys_argv_set(a) diff --git a/geo-replication/syncdaemon/argsupgrade.py b/geo-replication/syncdaemon/argsupgrade.py index 18edb6ba5b..a97c748c40 100644 --- a/geo-replication/syncdaemon/argsupgrade.py +++ b/geo-replication/syncdaemon/argsupgrade.py @@ -1,5 +1,6 @@ # Converts old style args into new style args +from __future__ import print_function import sys from argparse import ArgumentParser import socket @@ -136,8 +137,8 @@ def upgrade(): user, hname = remote_addr.split("@") - print("ssh://%s@%s:gluster://127.0.0.1:%s" % ( - user, gethostbyname(hname), vol)) + print(("ssh://%s@%s:gluster://127.0.0.1:%s" % ( + user, gethostbyname(hname), vol))) sys.exit(0) elif "--normalize-url" in sys.argv: @@ -146,7 +147,7 @@ def upgrade(): p = ArgumentParser() p.add_argument("--normalize-url") pargs = p.parse_known_args(sys.argv[1:])[0] - print("ssh://%s" % slave_url(pargs.normalize_url)) + print(("ssh://%s" % slave_url(pargs.normalize_url))) sys.exit(0) elif "--config-get-all" in sys.argv: # -c gsyncd.conf --iprefix=/var :gv1 f241::gv2 --config-get-all diff --git a/geo-replication/syncdaemon/gsyncdstatus.py b/geo-replication/syncdaemon/gsyncdstatus.py index b1fed727cb..02584b311d 100644 --- a/geo-replication/syncdaemon/gsyncdstatus.py +++ b/geo-replication/syncdaemon/gsyncdstatus.py @@ -9,6 +9,7 @@ # cases as published by the Free Software Foundation. # +from __future__ import print_function import fcntl import os import tempfile @@ -406,8 +407,8 @@ class GeorepStatus(object): # Convert all values as string for k, v in status_out.items(): out[k] = str(v) - print json.dumps(out) + print(json.dumps(out)) return for key, value in status_out.items(): - print ("%s: %s" % (key, value)) + print(("%s: %s" % (key, value))) diff --git a/geo-replication/syncdaemon/subcmds.py b/geo-replication/syncdaemon/subcmds.py index 1b306ad5b6..b9e0285539 100644 --- a/geo-replication/syncdaemon/subcmds.py +++ b/geo-replication/syncdaemon/subcmds.py @@ -1,6 +1,7 @@ -import logging +from __future__ import print_function from syncdutils import lf +import logging import gsyncdconfig as gconf @@ -224,7 +225,7 @@ def print_config(name, value, only_value=False, use_underscore=False): if use_underscore: name = name.replace("-", "_") - print("%s:%s" % (name, val)) + print(("%s:%s" % (name, val))) def config_name_format(val): @@ -260,7 +261,7 @@ def subcmd_config_get(args): "modified": v["modified"] }) - print(json.dumps(out)) + print((json.dumps(out))) return for k in sorted(all_config): -- cgit