summaryrefslogtreecommitdiffstats
path: root/ipaserver/install/dsinstance.py
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2015-07-30 16:49:29 +0200
committerTomas Babej <tbabej@redhat.com>2015-08-12 18:17:23 +0200
commit27dabb45282911e375336f75934af9dd6cc5d963 (patch)
tree3c8fe5255d60613fa9cd14d053b3688feed740c9 /ipaserver/install/dsinstance.py
parenta651be3eec2a08bd2865b16b0eed767db69aab0f (diff)
downloadfreeipa-27dabb45282911e375336f75934af9dd6cc5d963.tar.gz
freeipa-27dabb45282911e375336f75934af9dd6cc5d963.tar.xz
freeipa-27dabb45282911e375336f75934af9dd6cc5d963.zip
Modernize 'except' clauses
The 'as' syntax works from Python 2 on, and Python 3 will drop the "comma" syntax. Reviewed-By: Tomas Babej <tbabej@redhat.com>
Diffstat (limited to 'ipaserver/install/dsinstance.py')
-rw-r--r--ipaserver/install/dsinstance.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py
index 45a523e9b..2657e2f99 100644
--- a/ipaserver/install/dsinstance.py
+++ b/ipaserver/install/dsinstance.py
@@ -442,7 +442,7 @@ class DsInstance(service.Service):
try:
ipautil.run(args)
root_logger.debug("completed creating ds instance")
- except ipautil.CalledProcessError, e:
+ except ipautil.CalledProcessError as e:
root_logger.critical("failed to create ds instance %s" % e)
# check for open port 389 from now on
@@ -452,7 +452,7 @@ class DsInstance(service.Service):
try:
self.__restart_instance()
root_logger.debug("done restarting ds instance")
- except ipautil.CalledProcessError, e:
+ except ipautil.CalledProcessError as e:
print "failed to restart ds instance", e
root_logger.debug("failed to restart ds instance %s" % e)
inf_fd.close()
@@ -484,9 +484,9 @@ class DsInstance(service.Service):
if not is_ds_running(instance):
root_logger.critical("Failed to restart the directory server. See the installation log for details.")
sys.exit(1)
- except SystemExit, e:
+ except SystemExit as e:
raise e
- except Exception, e:
+ except Exception as e:
# TODO: roll back here?
root_logger.critical("Failed to restart the directory server (%s). See the installation log for details." % e)
@@ -771,7 +771,7 @@ class DsInstance(service.Service):
'LDAPTLS_CACERT':CACERT }
ipautil.run(args, env=env)
root_logger.debug("ldappasswd done")
- except ipautil.CalledProcessError, e:
+ except ipautil.CalledProcessError as e:
print "Unable to set admin password", e
root_logger.debug("Unable to set admin password %s" % e)
@@ -793,7 +793,7 @@ class DsInstance(service.Service):
try:
self.fstore.restore_file(paths.LIMITS_CONF)
self.fstore.restore_file(paths.SYSCONFIG_DIRSRV)
- except ValueError, error:
+ except ValueError as error:
root_logger.debug(error)
pass
@@ -829,7 +829,7 @@ class DsInstance(service.Service):
for ds_instance in get_ds_instances():
try:
services.knownservices.dirsrv.restart(ds_instance, wait=False)
- except Exception, e:
+ except Exception as e:
root_logger.error('Unable to restart ds instance %s: %s', ds_instance, e)
def stop_tracking_certificates(self, serverid=None):
@@ -859,7 +859,7 @@ class DsInstance(service.Service):
root_logger.critical("The given CA cert file named [%s] could not be read" %
cacert_fname)
return False
- except OSError, e:
+ except OSError as e:
root_logger.critical("The given CA cert file named [%s] could not be read: %s" %
(cacert_fname, str(e)))
return False
@@ -876,7 +876,7 @@ class DsInstance(service.Service):
status = True
try:
certdb.load_cacert(cacert_fname, 'C,,')
- except ipautil.CalledProcessError, e:
+ except ipautil.CalledProcessError as e:
root_logger.critical("Error importing CA cert file named [%s]: %s" %
(cacert_fname, str(e)))
status = False
@@ -1025,7 +1025,7 @@ class DsInstance(service.Service):
ret['result']['ipacertificatesubjectbase'][0])
root_logger.debug(
'Found certificate subject base in DS: %s', subject_base)
- except errors.PublicError, e:
+ except errors.PublicError as e:
root_logger.error('Cannot connect to DS to find certificate '
'subject base: %s', e)
finally: