diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2015-06-04 16:26:30 +0200 |
---|---|---|
committer | Tomas Babej <tbabej@redhat.com> | 2015-06-29 13:37:30 +0200 |
commit | 29c01e5ef4d4bb8c608720c3e027d8d75b24fcd3 (patch) | |
tree | 700f8942fce6f55b10301dfa3d53117d514f4fee | |
parent | 9b6f1a4f9f7718819105da10a4ab20e66fe578b5 (diff) | |
download | freeipa-29c01e5ef4d4bb8c608720c3e027d8d75b24fcd3.tar.gz freeipa-29c01e5ef4d4bb8c608720c3e027d8d75b24fcd3.tar.xz freeipa-29c01e5ef4d4bb8c608720c3e027d8d75b24fcd3.zip |
fix handling of ldap.LDAPError in installer
'info' is optional component in LDAPError
http://www.python-ldap.org/doc/html/ldap.html#exceptions
Reviewed-By: Martin Basti <mbasti@redhat.com>
-rw-r--r-- | ipaserver/install/installutils.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py index 42df2b711..9329a51f5 100644 --- a/ipaserver/install/installutils.py +++ b/ipaserver/install/installutils.py @@ -780,12 +780,16 @@ def handle_error(error, log_file_name=None): if isinstance(error, ldap.INSUFFICIENT_ACCESS): return "Insufficient access", 1 if isinstance(error, ldap.LOCAL_ERROR): - return error.args[0]['info'], 1 + return error.args[0].get('info', ''), 1 if isinstance(error, ldap.SERVER_DOWN): return error.args[0]['desc'], 1 if isinstance(error, ldap.LDAPError): - return 'LDAP error: %s\n%s' % ( - type(error).__name__, error.args[0]['info']), 1 + message = 'LDAP error: %s\n%s\n%s' % ( + type(error).__name__, + error.args[0]['desc'].strip(), + error.args[0].get('info', '').strip() + ) + return message, 1 if isinstance(error, config.IPAConfigError): message = "An IPA server to update cannot be found. Has one been configured yet?" |