diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2019-02-05 23:51:13 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2019-02-05 23:51:13 +0100 |
commit | c19f6525465065496c485a5084a86707e4923580 (patch) | |
tree | eca4439d3eb4fba5427dbae28f7a51e143af91e9 /lib/modules/openldap | |
parent | fc337924c7e66258319c6b6d538660240cfeda5e (diff) |
Port custom modules to python3.
Diffstat (limited to 'lib/modules/openldap')
-rw-r--r-- | lib/modules/openldap | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/modules/openldap b/lib/modules/openldap index 9b015b6..9afe1f1 100644 --- a/lib/modules/openldap +++ b/lib/modules/openldap @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # Manage OpenLDAP databases # Copyright (c) 2013 Guilhem Moulin <guilhem@fripost.org> @@ -303,7 +303,7 @@ def main(): try: r = l.search_s( name, ldap.SCOPE_BASE, filterStr, attrsonly=1 ) - except ldap.LDAPError, ldap.NO_SUCH_OBJECT: + except (ldap.LDAPError, ldap.NO_SUCH_OBJECT): r = None if r: @@ -352,9 +352,9 @@ def main(): changed = parser.changed l.unbind_s() - except subprocess.CalledProcessError, e: + except subprocess.CalledProcessError as e: module.fail_json(rv=e.returncode, msg=e.output.rstrip()) - except ldap.LDAPError, e: + except ldap.LDAPError as e: e = e.args[0] if 'info' in e.keys(): msg = e['info'] @@ -363,7 +363,7 @@ def main(): else: msg = str(e) module.fail_json(msg=msg) - except KeyError, e: + except KeyError as e: module.fail_json(msg=str(e)) module.exit_json(changed=changed) |