Add exception handling when whoami_s in ldaptest fails
Jira:
@@ -43,7 +43,6 @@ if sys.version_info[0] > 2:
else:
from django.utils.translation import ugettext as _
-
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.DEBUG)
ch = logging.StreamHandler(sys.stdout)
@@ -142,6 +141,7 @@ will typically work with Active Directory/LDAP. Typically this is member
for Active Directory and LDAP.
"""
+
class Command(BaseCommand):
def print_ldap_global_settings(self, cfg, is_multi_ldap):
LOG.info('[desktop]')
@@ -471,7 +471,6 @@ class Command(BaseCommand):
self.sys_exit(err_code)
-
def check_single_ldap_setting(self, ldap_config, is_multi_ldap=False):
self.print_ldap_setting(ldap_config, is_multi_ldap)
# Basic validation check for hue.ini's ldap parameters [desktop] > [[ldap]]
@@ -506,7 +505,11 @@ class Command(BaseCommand):
LOG.warning(ldapsearch)
self.sys_exit(err_code)
+ try:
LOG.info('LDAP whoami_s() %s' % (connection.ldap_handle.whoami_s()))
+ except:
+ LOG.warn('Not able to execute whoami_s() command')
+
if ldap_config.TEST_LDAP_USER.get() is not None:
err_code = self.find_ldapusers(ldap_config, connection)
if err_code:
