diff options
author | kali <kali@leap.se> | 2012-09-05 10:23:24 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2012-09-05 10:23:24 +0900 |
commit | c190b7f66cc1977d0e058bfa2d8fc1a850326320 (patch) | |
tree | 2f19a173c5e312c09d4bbe379749d534b7f23199 /src/leap/eip/eipconnection.py | |
parent | 535e584ba978a7a234a52df14f89197fbc3cea14 (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/eip/eipconnection.py')
-rw-r--r-- | src/leap/eip/eipconnection.py | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/leap/eip/eipconnection.py b/src/leap/eip/eipconnection.py index 3a6f4d49..e090f9a7 100644 --- a/src/leap/eip/eipconnection.py +++ b/src/leap/eip/eipconnection.py @@ -3,6 +3,7 @@ EIP Connection Class """ from __future__ import (absolute_import,) import logging +import Queue from leap.eip.checks import EIPConfigChecker from leap.eip import exceptions as eip_exceptions @@ -23,8 +24,8 @@ class EIPConnection(OpenVPNConnection): self.settingsfile = kwargs.get('settingsfile', None) self.logfile = kwargs.get('logfile', None) - # not used atm. but should. - self.error_queue = [] + # XXX USE THIS + self.error_queue = Queue.Queue() status_signals = kwargs.pop('status_signals', None) self.status = EIPConnectionStatus(callbacks=status_signals) @@ -36,7 +37,12 @@ class EIPConnection(OpenVPNConnection): """ run all eip checks previous to attempting a connection """ - self.config_checker.run_all(skip_download=skip_download) + logger.debug('running conductor checks') + try: + self.config_checker.run_all(skip_download=skip_download) + self.run_openvpn_checks() + except Exception as exc: + self.error_queue.put(exc) def connect(self): """ @@ -44,7 +50,6 @@ class EIPConnection(OpenVPNConnection): """ self.forget_errors() self._try_connection() - # XXX should capture errors? def disconnect(self): """ @@ -65,11 +70,11 @@ class EIPConnection(OpenVPNConnection): """ return self.status.current - def desired_connection_state(self): - """ - returns the desired_connection state - """ - return self.desired_con_state + #def desired_connection_state(self): + #""" + #returns the desired_connection state + #""" + #return self.desired_con_state def poll_connection_state(self): """ @@ -107,26 +112,27 @@ class EIPConnection(OpenVPNConnection): private method for disconnecting """ if self.subp is not None: + logger.debug('disconnecting...') self.subp.terminate() self.subp = None - # XXX signal state changes! :) - def _is_alive(self): - """ - don't know yet - """ - pass + #def _is_alive(self): + #""" + #don't know yet + #""" + #pass def _connect(self): """ entry point for connection cascade methods. """ - #conn_result = ConState.DISCONNECTED try: conn_result = self._try_connection() except eip_exceptions.UnrecoverableError as except_msg: logger.error("FATAL: %s" % unicode(except_msg)) conn_result = self.status.UNRECOVERABLE + + # XXX enqueue exceptions themselves instead? except Exception as except_msg: self.error_queue.append(except_msg) logger.error("Failed Connection: %s" % |