based on: http://fpaste.org/228856/25049143/

The patch is not tested.

Description:
'info' is optional component in LDAPError

http://www.python-ldap.org/doc/html/ldap.html#exceptions
--
Petr Vobornik
From 72dc6f55594f42b4ae6dc700335723529d7dbee3 Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Thu, 4 Jun 2015 16:26:30 +0200
Subject: [PATCH] fix handling of ldap.LDAPError in installer

'info' is optional component in LDAPError

http://www.python-ldap.org/doc/html/ldap.html#exceptions
---
 ipaserver/install/installutils.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py
index 817c27e699b5fd3213362275ba72535344e5bc8c..64a3a7a9e3e60d246824ca6d8569fb6f250f514a 100644
--- a/ipaserver/install/installutils.py
+++ b/ipaserver/install/installutils.py
@@ -791,12 +791,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?"
-- 
2.1.0

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to