diff options
author | Petr Viktorin <pviktori@redhat.com> | 2015-07-30 16:49:29 +0200 |
---|---|---|
committer | Tomas Babej <tbabej@redhat.com> | 2015-08-12 18:17:23 +0200 |
commit | 27dabb45282911e375336f75934af9dd6cc5d963 (patch) | |
tree | 3c8fe5255d60613fa9cd14d053b3688feed740c9 /ipaserver/install/ipa_restore.py | |
parent | a651be3eec2a08bd2865b16b0eed767db69aab0f (diff) | |
download | freeipa-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/ipa_restore.py')
-rw-r--r-- | ipaserver/install/ipa_restore.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py index 62b31c580..65cb49355 100644 --- a/ipaserver/install/ipa_restore.py +++ b/ipaserver/install/ipa_restore.py @@ -401,7 +401,7 @@ class Restore(admintool.AdminTool): finally: try: os.chdir(cwd) - except Exception, e: + except Exception as e: self.log.error('Cannot change directory to %s: %s' % (cwd, e)) shutil.rmtree(self.top_dir) @@ -421,7 +421,7 @@ class Restore(admintool.AdminTool): try: pw_name = pwd.getpwuid(os.geteuid()).pw_name self._conn.do_external_bind(pw_name) - except Exception, e: + except Exception as e: raise admintool.ScriptError('Unable to bind to LDAP server: %s' % e) return self._conn @@ -435,14 +435,14 @@ class Restore(admintool.AdminTool): ''' try: conn = self.get_connection() - except Exception, e : + except Exception as e: self.log.error('Unable to get connection, skipping disabling agreements: %s' % e) return masters = [] dn = DN(('cn', 'masters'), ('cn', 'ipa'), ('cn', 'etc'), api.env.basedn) try: entries = conn.get_entries(dn, conn.SCOPE_ONELEVEL) - except Exception, e: + except Exception as e: raise admintool.ScriptError( "Failed to read master data: %s" % e) else: @@ -455,7 +455,7 @@ class Restore(admintool.AdminTool): try: repl = ReplicationManager(api.env.realm, master, self.dirman_password) - except Exception, e: + except Exception as e: self.log.critical("Unable to disable agreement on %s: %s" % (master, e)) continue @@ -480,7 +480,7 @@ class Restore(admintool.AdminTool): try: repl = get_cs_replication_manager(api.env.realm, master, self.dirman_password) - except Exception, e: + except Exception as e: self.log.critical("Unable to disable agreement on %s: %s" % (master, e)) continue @@ -537,7 +537,7 @@ class Restore(admintool.AdminTool): try: conn.add_entry(ent) - except Exception, e: + except Exception as e: self.log.error("Unable to bind to LDAP server: %s" % e) return @@ -595,7 +595,7 @@ class Restore(admintool.AdminTool): try: conn.add_entry(ent) - except Exception, e: + except Exception as e: raise admintool.ScriptError('Unable to bind to LDAP server: %s' % e) @@ -773,7 +773,7 @@ class Restore(admintool.AdminTool): os.mkdir(dir, 0o770) os.chown(dir, pent.pw_uid, pent.pw_gid) tasks.restore_context(dir) - except Exception, e: + except Exception as e: # This isn't so fatal as to side-track the restore self.log.error('Problem with %s: %s' % (dir, e)) |