summaryrefslogtreecommitdiff
path: root/src/leap/baseapp/eip.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-09-05 10:23:24 +0900
committerkali <kali@leap.se>2012-09-05 10:23:24 +0900
commitc190b7f66cc1977d0e058bfa2d8fc1a850326320 (patch)
tree2f19a173c5e312c09d4bbe379749d534b7f23199 /src/leap/baseapp/eip.py
parent535e584ba978a7a234a52df14f89197fbc3cea14 (diff)
missing_pkexec error converted to "auto" error.
idea is that we define user messages in the exceptions, and queue them during (conductor) checks. user facing dialogs get constucted from exception attrs. if critical, log as such and exit.
Diffstat (limited to 'src/leap/baseapp/eip.py')
-rw-r--r--src/leap/baseapp/eip.py59
1 files changed, 41 insertions, 18 deletions
diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py
index 856cb197..dd88b7f5 100644
--- a/src/leap/baseapp/eip.py
+++ b/src/leap/baseapp/eip.py
@@ -12,6 +12,7 @@ logger = logging.getLogger(name=__name__)
class EIPConductorApp(object):
+ # XXX EIPConductorMixin ?
"""
initializes an instance of EIPConnection,
gathers errors, and passes status-change signals
@@ -51,8 +52,38 @@ class EIPConductorApp(object):
lambda: self.start_or_stopVPN())
def error_check(self):
-
- # XXX refactor (by #504)
+ logger.debug('error check')
+
+ #####################################
+ # XXX refactor in progress (by #504)
+ errq = self.conductor.error_queue
+ while errq.qsize() != 0:
+ logger.debug('%s errors left in conductor queue', errq.qsize())
+ error = errq.get()
+ logger.error('%s: %s', error.__class__.__name__, error.message)
+
+ if issubclass(error.__class__, eip_exceptions.EIPClientError):
+ if error.critical:
+ logger.critical(error.message)
+ logger.error('quitting')
+
+ # XXX
+ # check headless = False before
+ # launching dialog.
+ # (for Qt tests)
+
+ dialog = ErrorDialog()
+ if getattr(error, 'usermessage', None):
+ message = error.usermessage
+ else:
+ message = error.message
+ dialog.criticalMessage(message, 'error')
+ else:
+ logger.exception(error.message)
+ else:
+ import traceback
+ traceback.print_exc()
+ raise error
if self.conductor.missing_definition is True:
dialog = ErrorDialog()
@@ -78,12 +109,14 @@ class EIPConductorApp(object):
# os.kill of subprocess fails if we have
# some of this errors.
- if self.conductor.bad_provider is True:
- dialog = ErrorDialog()
- dialog.criticalMessage(
- 'Bad provider entry. Check that remote_ip entry '
- 'has an IP under section [provider] in eip.cfg',
- 'error')
+ # deprecated.
+ # get something alike.
+ #if self.conductor.bad_provider is True:
+ #dialog = ErrorDialog()
+ #dialog.criticalMessage(
+ #'Bad provider entry. Check that remote_ip entry '
+ #'has an IP under section [provider] in eip.cfg',
+ #'error')
if self.conductor.bad_keyfile_perms is True:
dialog = ErrorDialog()
@@ -91,16 +124,6 @@ class EIPConductorApp(object):
'The vpn keys file has bad permissions',
'error')
- if self.conductor.missing_auth_agent is True:
- dialog = ErrorDialog()
- dialog.warningMessage(
- 'We could not find any authentication '
- 'agent in your system.<br/>'
- 'Make sure you have '
- '<b>polkit-gnome-authentication-agent-1</b> '
- 'running and try again.',
- 'error')
-
if self.conductor.missing_pkexec is True:
dialog = ErrorDialog()
dialog.warningMessage(