diff --git a/management/univention-management-console/src/univention/management/console/base.py b/management/univention-management-console/src/univention/management/console/base.py index faf71e2138..72065834a2 100644 --- a/management/univention-management-console/src/univention/management/console/base.py +++ b/management/univention-management-console/src/univention/management/console/base.py @@ -126,7 +126,7 @@ def query(self, request): from univention.management.console.ldap import get_user_connection, reset_cache as reset_ldap_connection_cache from univention.management.console.config import ucr from univention.management.console.log import MODULE, CORE -from univention.management.console.error import UMC_Error, NotAcceptable, PasswordRequired, LDAP_ServerDown, LDAP_ConnectionFailed, Unauthorized +from univention.management.console.error import UMC_Error, NotAcceptable, PasswordRequired, LDAP_ServerDown, LDAP_ConnectionFailed _ = Translation('univention.management.console').translate @@ -299,17 +299,14 @@ def error_handling(self, etype, exc, etraceback): :param exc: The exception instance. :param etraceback: The exception traceback instance; may be None. """ - if isinstance(exc, udm_errors.ldapError) and isinstance(getattr(exc, 'original_exception', None), ldap.SERVER_DOWN): - exc = exc.original_exception - if isinstance(exc, udm_errors.ldapError) and isinstance(getattr(exc, 'original_exception', None), ldap.INVALID_CREDENTIALS): + if isinstance(exc, udm_errors.ldapError) and isinstance(getattr(exc, 'original_exception', None), (ldap.SERVER_DOWN, ldap.INVALID_CREDENTIALS)): exc = exc.original_exception if isinstance(exc, ldap.SERVER_DOWN): raise LDAP_ServerDown() - if isinstance(exc, ldap.CONNECT_ERROR): + if isinstance(exc, (ldap.CONNECT_ERROR, ldap.INVALID_CREDENTIALS)): raise LDAP_ConnectionFailed(exc) if isinstance(exc, ldap.INVALID_CREDENTIALS): reset_ldap_connection_cache() - raise Unauthorized def __error_handling(self, request, method, etype, exc, etraceback): """ diff --git a/management/univention-management-console/src/univention/management/console/error.py b/management/univention-management-console/src/univention/management/console/error.py index 74754fcaad..a846489022 100644 --- a/management/univention-management-console/src/univention/management/console/error.py +++ b/management/univention-management-console/src/univention/management/console/error.py @@ -143,7 +143,7 @@ def __init__(self, exc): def _error_msg(self): yield _('Cannot connect to the LDAP service.') - yield _('Error message: %s') % (self.exc.args[0].get('info', ''),) + yield _('Error message: %s') % (self.exc.args[0].get('info', self.exc.args[0].get('desc', '')),) yield '' yield _('The following steps can help to solve this problem:') if not self._is_master: diff --git a/management/univention-management-console/src/univention/management/console/protocol/session.py b/management/univention-management-console/src/univention/management/console/protocol/session.py index 71bdc97d6e..724c6855eb 100644 --- a/management/univention-management-console/src/univention/management/console/protocol/session.py +++ b/management/univention-management-console/src/univention/management/console/protocol/session.py @@ -149,7 +149,10 @@ class ProcessorBase(Base): @property def lo(self): - return get_machine_connection(write=False)[0] + try: + return get_machine_connection(write=False)[0] + except ldap.INVALID_CREDENTIALS as exc: + CORE.info('Could not get machine connection: %s' % (exc,)) def __init__(self): Base.__init__(self, 'univention-management-console')