summaryrefslogtreecommitdiffstats
path: root/install/tools/ipa-adtrust-install
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 /install/tools/ipa-adtrust-install
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 'install/tools/ipa-adtrust-install')
-rwxr-xr-xinstall/tools/ipa-adtrust-install18
1 files changed, 9 insertions, 9 deletions
diff --git a/install/tools/ipa-adtrust-install b/install/tools/ipa-adtrust-install
index 21e58dd9f..a3037440c 100755
--- a/install/tools/ipa-adtrust-install
+++ b/install/tools/ipa-adtrust-install
@@ -194,7 +194,7 @@ def set_and_check_netbios_name(netbios_name, unattended):
def ensure_admin_kinit(admin_name, admin_password):
try:
ipautil.run(['kinit', admin_name], stdin=admin_password+'\n')
- except ipautil.CalledProcessError, e:
+ except ipautil.CalledProcessError as e:
print "There was error to automatically re-kinit your admin user ticket."
return False
return True
@@ -305,14 +305,14 @@ def main():
ctx = krbV.default_context()
ccache = ctx.default_ccache()
principal = ccache.principal()
- except krbV.Krb5Error, e:
+ except krbV.Krb5Error as e:
sys.exit("Must have Kerberos credentials to setup AD trusts on server")
try:
api.Backend.ldap2.connect(ccache)
- except errors.ACIError, e:
+ except errors.ACIError as e:
sys.exit("Outdated Kerberos credentials. Use kdestroy and kinit to update your ticket")
- except errors.DatabaseError, e:
+ except errors.DatabaseError as e:
sys.exit("Cannot connect to the LDAP database. Please check if IPA is running")
try:
@@ -321,9 +321,9 @@ def main():
if not (user['uid'][0] in group['member_user'] and
group['cn'][0] in user['memberof_group']):
raise errors.RequirementError(name='admins group membership')
- except errors.RequirementError, e:
+ except errors.RequirementError as e:
sys.exit("Must have administrative privileges to setup AD trusts on server")
- except Exception, e:
+ except Exception as e:
sys.exit("Unrecognized error during check of admin rights: %s" % (str(e)))
(netbios_name, reset_netbios_name) = \
@@ -344,7 +344,7 @@ def main():
except errors.NotFound:
# All objects have SIDs assigned
pass
- except (errors.DatabaseError, errors.NetworkError), e:
+ except (errors.DatabaseError, errors.NetworkError) as e:
print "Could not retrieve a list of objects that need a SID identifier assigned:"
print unicode(e)
else:
@@ -400,7 +400,7 @@ def main():
base_dn=masters_dn, attrs_list=['cn'], scope=ldap.SCOPE_ONELEVEL)
except errors.NotFound:
pass
- except (errors.DatabaseError, errors.NetworkError), e:
+ except (errors.DatabaseError, errors.NetworkError) as e:
print "Could not retrieve a list of existing IPA masters:"
print unicode(e)
@@ -409,7 +409,7 @@ def main():
base_dn=agents_dn, attrs_list=['member'], scope=ldap.SCOPE_BASE)
except errors.NotFound:
pass
- except (errors.DatabaseError, errors.NetworkError), e:
+ except (errors.DatabaseError, errors.NetworkError) as e:
print "Could not retrieve a list of adtrust agents:"
print unicode(e)