summaryrefslogtreecommitdiffstats
path: root/lib/openldap
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2013-12-01 22:20:41 +0100
committerGuilhem Moulin <guilhem@fripost.org>2015-06-07 02:51:01 +0200
commitad5c4ebef590371352b4349443a7661fd25301ac (patch)
tree1f7c97363620379de08098e800752483c15570fa /lib/openldap
parent4895573883df830a82b65b8ecf96abde18370147 (diff)
Not all LDAPError's have an 'info' key.
Diffstat (limited to 'lib/openldap')
-rw-r--r--lib/openldap9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/openldap b/lib/openldap
index 983299a..020017c 100644
--- a/lib/openldap
+++ b/lib/openldap
@@ -336,7 +336,14 @@ def main():
except subprocess.CalledProcessError, e:
module.fail_json(rv=e.returncode, msg=e.output.rstrip())
except ldap.LDAPError, e:
- module.fail_json(msg=e.args[0]['info'])
+ e = e.args[0]
+ if 'info' in e.keys():
+ msg = e['info']
+ elif 'desc' in e.keys():
+ msg = e['desc']
+ else:
+ msg = str(e)
+ module.fail_json(msg=msg)
except KeyError, e:
module.fail_json(msg=str(e))