From 29c01e5ef4d4bb8c608720c3e027d8d75b24fcd3 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Thu, 4 Jun 2015 16:26:30 +0200 Subject: 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 --- ipaserver/install/installutils.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'ipaserver') 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?" -- cgit