Univention Bugzilla – Attachment 7403 Details for
Bug 40069
Abort exception not handled by AppCenter
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
40069.patch (text/plain), 3.79 KB, created by
Florian Best
on 2016-01-12 16:34 CET
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Florian Best
Created:
2016-01-12 16:34 CET
Size:
3.79 KB
patch
obsolete
>diff --git a/management/univention-appcenter/python/appcenter/actions/__init__.py b/management/univention-appcenter/python/appcenter/actions/__init__.py >index 7c39ff3..40b4b0e 100644 >--- a/management/univention-appcenter/python/appcenter/actions/__init__.py >+++ b/management/univention-appcenter/python/appcenter/actions/__init__.py >@@ -51,7 +51,9 @@ > > > class Abort(Exception): >- pass >+ def __init__(self, *args, **kwargs): >+ self.exc_info = kwargs.pop('exc_info', None) >+ super(Abort, self).__init__(*args) > > > class NetworkError(Abort): >diff --git a/management/univention-appcenter/python/appcenter/actions/credentials.py b/management/univention-appcenter/python/appcenter/actions/credentials.py >index 1ad71bf..9339322 100644 >--- a/management/univention-appcenter/python/appcenter/actions/credentials.py >+++ b/management/univention-appcenter/python/appcenter/actions/credentials.py >@@ -38,6 +38,7 @@ > from contextlib import contextmanager > from copy import deepcopy > import time >+import sys > > import ldap > >@@ -124,10 +125,10 @@ def _get_machine_connection(self): > raise Abort() > except ldap.INVALID_CREDENTIALS: > self.fatal('LDAP server does not accept machine password!') >- raise Abort() >+ raise Abort(exc_info=sys.exc_info()) > except ldap.SERVER_DOWN: > self.fatal('LDAP server is not running!') >- raise Abort() >+ raise Abort(exc_info=sys.exc_info()) > > def _get_admin_connection(self): > try: >@@ -137,10 +138,10 @@ def _get_admin_connection(self): > raise Abort() > except ldap.INVALID_CREDENTIALS: > self.fatal('LDAP server does not accept admin password!') >- raise Abort() >+ raise Abort(exc_info=sys.exc_info()) > except ldap.SERVER_DOWN: > self.fatal('LDAP server is not running!') >- raise Abort() >+ raise Abort(exc_info=sys.exc_info()) > > def _get_ldap_connection(self, args, allow_machine_connection=False, allow_admin_connection=True): > if allow_admin_connection: >@@ -169,7 +170,7 @@ def _get_ldap_connection(self, args, allow_machine_connection=False, allow_admin > return get_connection(userdn, password) > except ldap.SERVER_DOWN: > self.fatal('LDAP server is not running!') >- raise Abort() >+ raise Abort(exc_info=sys.exc_info()) > except ldap.INVALID_CREDENTIALS: > time.sleep(0.1) > self.warn('Invalid credentials') >diff --git a/management/univention-appcenter/umc/python/appcenter/__init__.py b/management/univention-appcenter/umc/python/appcenter/__init__.py >index 615c6ce..4bb463f 100644 >--- a/management/univention-appcenter/umc/python/appcenter/__init__.py >+++ b/management/univention-appcenter/umc/python/appcenter/__init__.py >@@ -46,6 +46,7 @@ > import notifier > import notifier.threads > import apt # for independent apt.Cache >+import ldap > > # univention > from univention.lib.package_manager import PackageManager, LockError >@@ -59,6 +60,7 @@ > import univention.management.console as umc > import univention.management.console.modules as umcm > from univention.appcenter import get_action, AppManager >+from univention.appcenter.actions import Abort > from univention.appcenter.utils import docker_is_running, call_process > from univention.appcenter.log import get_base_logger, log_to_logfile > from univention.appcenter.ucr import ucr_instance, ucr_save >@@ -160,9 +162,14 @@ def init(self): > get_base_logger().getChild('actions.remove.progress').addHandler(percentage) > > def error_handling(self, exc, etype, etraceback): >+ if isinstance(exc, Abort) and exc.exc_info: >+ self.error_handling(*exc.exc_info) >+ if isinstance(exc, ldap.INVALID_CREDENTIALS): >+ pass # TODO: raise umcm.UMC_Error(userfriendly_message, status=500) > if isinstance(exc, (SystemError, AppcenterServerContactFailed)): > MODULE.error(str(exc)) > raise umcm.UMC_Error(str(exc), status=500) >+ super(Instance, self).error_handling(exc, etype, etraceback) > > @simple_response > def version(self):
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 40069
: 7403