summaryrefslogtreecommitdiffstats
path: root/base/server
diff options
context:
space:
mode:
authorChristian Heimes <cheimes@redhat.com>2015-07-15 11:11:35 +0200
committerChristian Heimes <cheimes@redhat.com>2015-08-10 11:58:44 +0200
commit1738f27d3683d58b3ab023724eb8d0133c428eef (patch)
treeb45ef3fe9ccea6121f29b7b10c8eca5cf1ea0967 /base/server
parent8ae5ec7f3774d81a1c3d79c2a05649de65b8658c (diff)
downloadpki-1738f27d3683d58b3ab023724eb8d0133c428eef.tar.gz
pki-1738f27d3683d58b3ab023724eb8d0133c428eef.tar.xz
pki-1738f27d3683d58b3ab023724eb8d0133c428eef.zip
Replace Exception.message with str(exc)
Python 3 has deprecated and remove Exception.message. Instead we should simply use string formatting to print the message of an Exception. >>> import pki >>> pki.PKIException('msg') PKIException('msg',) >>> pki.PKIException('msg').message 'msg' >>> str(pki.PKIException('msg')) 'msg' >>> '%s' % pki.PKIException('msg') 'msg'
Diffstat (limited to 'base/server')
-rw-r--r--base/server/python/pki/server/upgrade.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/base/server/python/pki/server/upgrade.py b/base/server/python/pki/server/upgrade.py
index c9426a07c..1db945e12 100644
--- a/base/server/python/pki/server/upgrade.py
+++ b/base/server/python/pki/server/upgrade.py
@@ -95,7 +95,7 @@ class PKIServerUpgradeScriptlet(pki.upgrade.PKIUpgradeScriptlet):
if verbose:
traceback.print_exc()
else:
- print 'ERROR: ' + e.message
+ print 'ERROR: %s' % e
message = 'Failed upgrading ' + str(instance) + ' instance.'
if self.upgrader.silent:
@@ -109,8 +109,7 @@ class PKIServerUpgradeScriptlet(pki.upgrade.PKIUpgradeScriptlet):
continue
raise pki.server.PKIServerException(
- 'Upgrade failed in ' + str(instance) + ': ' + e.message,
- e, instance)
+ 'Upgrade failed in %s: %s' % (instance, e), e, instance)
def upgrade_subsystems(self, instance):
@@ -132,7 +131,7 @@ class PKIServerUpgradeScriptlet(pki.upgrade.PKIUpgradeScriptlet):
if verbose:
traceback.print_exc()
else:
- print 'ERROR: ' + e.message
+ print 'ERROR: %s' % e
message = 'Failed upgrading ' + str(subsystem) + ' subsystem.'
if self.upgrader.silent:
@@ -146,7 +145,7 @@ class PKIServerUpgradeScriptlet(pki.upgrade.PKIUpgradeScriptlet):
continue
raise pki.server.PKIServerException(
- 'Upgrade failed in ' + str(subsystem) + ': ' + e.message,
+ 'Upgrade failed in %s: %s' % (subsystem, e),
e, instance, subsystem)
def upgrade_subsystem(self, instance, subsystem):