View | Details | Raw Unified | Return to bug 40069
Collapse All | Expand All

(-)a/management/univention-appcenter/python/appcenter/actions/__init__.py (-1 / +3 lines)
 Lines 51-57    Link Here 
51
51
52
52
53
class Abort(Exception):
53
class Abort(Exception):
54
	pass
54
	def __init__(self, *args, **kwargs):
55
		self.exc_info = kwargs.pop('exc_info', None)
56
		super(Abort, self).__init__(*args)
55
57
56
58
57
class NetworkError(Abort):
59
class NetworkError(Abort):
(-)a/management/univention-appcenter/python/appcenter/actions/credentials.py (-5 / +6 lines)
 Lines 38-43    Link Here 
38
from contextlib import contextmanager
38
from contextlib import contextmanager
39
from copy import deepcopy
39
from copy import deepcopy
40
import time
40
import time
41
import sys
41
42
42
import ldap
43
import ldap
43
44
 Lines 124-133   def _get_machine_connection(self): Link Here 
124
			raise Abort()
125
			raise Abort()
125
		except ldap.INVALID_CREDENTIALS:
126
		except ldap.INVALID_CREDENTIALS:
126
			self.fatal('LDAP server does not accept machine password!')
127
			self.fatal('LDAP server does not accept machine password!')
127
			raise Abort()
128
			raise Abort(exc_info=sys.exc_info())
128
		except ldap.SERVER_DOWN:
129
		except ldap.SERVER_DOWN:
129
			self.fatal('LDAP server is not running!')
130
			self.fatal('LDAP server is not running!')
130
			raise Abort()
131
			raise Abort(exc_info=sys.exc_info())
131
132
132
	def _get_admin_connection(self):
133
	def _get_admin_connection(self):
133
		try:
134
		try:
 Lines 137-146   def _get_admin_connection(self): Link Here 
137
			raise Abort()
138
			raise Abort()
138
		except ldap.INVALID_CREDENTIALS:
139
		except ldap.INVALID_CREDENTIALS:
139
			self.fatal('LDAP server does not accept admin password!')
140
			self.fatal('LDAP server does not accept admin password!')
140
			raise Abort()
141
			raise Abort(exc_info=sys.exc_info())
141
		except ldap.SERVER_DOWN:
142
		except ldap.SERVER_DOWN:
142
			self.fatal('LDAP server is not running!')
143
			self.fatal('LDAP server is not running!')
143
			raise Abort()
144
			raise Abort(exc_info=sys.exc_info())
144
145
145
	def _get_ldap_connection(self, args, allow_machine_connection=False, allow_admin_connection=True):
146
	def _get_ldap_connection(self, args, allow_machine_connection=False, allow_admin_connection=True):
146
		if allow_admin_connection:
147
		if allow_admin_connection:
 Lines 169-175   def _get_ldap_connection(self, args, allow_machine_connection=False, allow_admin Link Here 
169
					return get_connection(userdn, password)
170
					return get_connection(userdn, password)
170
				except ldap.SERVER_DOWN:
171
				except ldap.SERVER_DOWN:
171
					self.fatal('LDAP server is not running!')
172
					self.fatal('LDAP server is not running!')
172
					raise Abort()
173
					raise Abort(exc_info=sys.exc_info())
173
				except ldap.INVALID_CREDENTIALS:
174
				except ldap.INVALID_CREDENTIALS:
174
					time.sleep(0.1)
175
					time.sleep(0.1)
175
					self.warn('Invalid credentials')
176
					self.warn('Invalid credentials')
(-)a/management/univention-appcenter/umc/python/appcenter/__init__.py (+7 lines)
 Lines 46-51    Link Here 
46
import notifier
46
import notifier
47
import notifier.threads
47
import notifier.threads
48
import apt  # for independent apt.Cache
48
import apt  # for independent apt.Cache
49
import ldap
49
50
50
# univention
51
# univention
51
from univention.lib.package_manager import PackageManager, LockError
52
from univention.lib.package_manager import PackageManager, LockError
 Lines 59-64    Link Here 
59
import univention.management.console as umc
60
import univention.management.console as umc
60
import univention.management.console.modules as umcm
61
import univention.management.console.modules as umcm
61
from univention.appcenter import get_action, AppManager
62
from univention.appcenter import get_action, AppManager
63
from univention.appcenter.actions import Abort
62
from univention.appcenter.utils import docker_is_running, call_process
64
from univention.appcenter.utils import docker_is_running, call_process
63
from univention.appcenter.log import get_base_logger, log_to_logfile
65
from univention.appcenter.log import get_base_logger, log_to_logfile
64
from univention.appcenter.ucr import ucr_instance, ucr_save
66
from univention.appcenter.ucr import ucr_instance, ucr_save
 Lines 160-168   def init(self): Link Here 
160
		get_base_logger().getChild('actions.remove.progress').addHandler(percentage)
162
		get_base_logger().getChild('actions.remove.progress').addHandler(percentage)
161
163
162
	def error_handling(self, exc, etype, etraceback):
164
	def error_handling(self, exc, etype, etraceback):
165
		if isinstance(exc, Abort) and exc.exc_info:
166
			self.error_handling(*exc.exc_info)
167
		if isinstance(exc, ldap.INVALID_CREDENTIALS):
168
			pass  # TODO: raise umcm.UMC_Error(userfriendly_message, status=500)
163
		if isinstance(exc, (SystemError, AppcenterServerContactFailed)):
169
		if isinstance(exc, (SystemError, AppcenterServerContactFailed)):
164
			MODULE.error(str(exc))
170
			MODULE.error(str(exc))
165
			raise umcm.UMC_Error(str(exc), status=500)
171
			raise umcm.UMC_Error(str(exc), status=500)
172
		super(Instance, self).error_handling(exc, etype, etraceback)
166
173
167
	@simple_response
174
	@simple_response
168
	def version(self):
175
	def version(self):

Return to bug 40069