diff options
author | Christian Heimes <cheimes@redhat.com> | 2015-08-16 19:00:00 +0200 |
---|---|---|
committer | Christian Heimes <cheimes@redhat.com> | 2015-08-17 21:14:12 +0200 |
commit | c46caa19d9e1fb429fd77693abcca2fe668366aa (patch) | |
tree | bb5ed5f4c2987959b53c4390783ae67f1d3a16d6 /base/server/python/pki/server/cli | |
parent | 1c7a2735c82d6af1a871efd2c01f942387821a1f (diff) | |
download | pki-c46caa19d9e1fb429fd77693abcca2fe668366aa.tar.gz pki-c46caa19d9e1fb429fd77693abcca2fe668366aa.tar.xz pki-c46caa19d9e1fb429fd77693abcca2fe668366aa.zip |
Py3 modernization: misc manual fixes
Python 3's exception class has no message attribute. e.message can
either be replaced with string representation of e or e.args[0].
Use print(line, end='') instead of sys.stdout.write(). With end='' no
new line is appended.
Use six.reraise() to reraise an exception.
Remove sys.exc_clear() as it is no longer available in Python 3.
Conditionally import shutil.WindowsError.
Use six.move to import correct modules / function like quote, urlparse
and configparser.
Silence some pylint warnings. pylint doesn't understand six.moves magic
and emits a import-error warning.
Add additional tox envs to check for Python 3 compatibility.
Diffstat (limited to 'base/server/python/pki/server/cli')
-rw-r--r-- | base/server/python/pki/server/cli/nuxwdog.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/base/server/python/pki/server/cli/nuxwdog.py b/base/server/python/pki/server/cli/nuxwdog.py index 674fc0340..bdcc18a00 100644 --- a/base/server/python/pki/server/cli/nuxwdog.py +++ b/base/server/python/pki/server/cli/nuxwdog.py @@ -119,7 +119,7 @@ class NuxwdogEnableCLI(pki.cli.CLI): def add_nuxwdog_link(self, instance): nuxwdog_jar_path = '/usr/lib/java/nuxwdog.jar' if not os.path.exists(nuxwdog_jar_path): - print ( + print( "Error: nuxwdog jar file does not exist. " "Is nuxwdog installed?" ) @@ -158,7 +158,7 @@ class NuxwdogEnableCLI(pki.cli.CLI): line = "USE_NUXWDOG=\"true\"\n" got_use_nuxwdog = True - sys.stdout.write(line) + print(line, end='') if not got_use_nuxwdog: with open(sysconfig_file, 'a') as f: @@ -247,7 +247,7 @@ class NuxwdogEnableCLI(pki.cli.CLI): match = re.search("^passwordClass=(.*)", line) if match: line = "passwordClass=" + pclass + "\n" - sys.stdout.write(line) + print(line, end='') os.chown(cs_cfg, instance.uid, instance.gid) @@ -336,7 +336,7 @@ class NuxwdogDisableCLI(pki.cli.CLI): if match: line = "USE_NUXWDOG=\"false\"\n" - sys.stdout.write(line) + print(line, end='') os.chown(sysconfig_file, instance.uid, instance.gid) @@ -402,5 +402,5 @@ class NuxwdogDisableCLI(pki.cli.CLI): match = re.search("^passwordClass=(.*)", line) if match: line = "passwordClass=" + pclass + "\n" - sys.stdout.write(line) + print(line, end='') os.chown(cs_cfg, instance.uid, instance.gid) |