diff options
Diffstat (limited to 'src/leap/baseapp/eip.py')
-rw-r--r-- | src/leap/baseapp/eip.py | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/leap/baseapp/eip.py b/src/leap/baseapp/eip.py index 515ae58d..b0e14be7 100644 --- a/src/leap/baseapp/eip.py +++ b/src/leap/baseapp/eip.py @@ -1,5 +1,7 @@ +from __future__ import print_function import logging import time +#import sys from PyQt4 import QtCore @@ -38,8 +40,11 @@ class EIPConductorAppMixin(object): debug=self.debugmode, ovpn_verbosity=opts.openvpn_verb) - # XXX remove skip download when sample service is ready - self.conductor.run_checks(skip_download=True) + skip_download = opts.no_provider_checks + skip_verify = opts.no_ca_verify + self.conductor.run_checks( + skip_download=skip_download, + skip_verify=skip_verify) self.error_check() # XXX should receive "ready" signal @@ -58,13 +63,11 @@ class EIPConductorAppMixin(object): """ 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() + # we get exception and original traceback from queue + error, tb = errq.get() # redundant log, debugging the loop. logger.error('%s: %s', error.__class__.__name__, error.message) @@ -73,10 +76,8 @@ class EIPConductorAppMixin(object): self.handle_eip_error(error) else: - # This is not quite working. FIXME - import traceback - traceback.print_exc() - raise error + # deprecated form of raising exception. + raise error, None, tb if error.failfirst is True: break @@ -132,6 +133,8 @@ class EIPConductorAppMixin(object): ErrorDialog(errtype="critical", msg=message, label="critical error") + elif error.warning: + logger.warning(error.message) else: dialog = ErrorDialog() @@ -151,13 +154,18 @@ class EIPConductorAppMixin(object): # from openvpn manager) if not self.eip_service_started: + # there is a race condition + # going on here. Depending on how long we take + # to init the qt app, the management socket + # is not ready yet. return if self.conductor.with_errors: #XXX how to wait on pkexec??? #something better that this workaround, plz!! - time.sleep(5) - logger.debug('timeout') + #I removed the pkexec pass authentication at all. + #time.sleep(5) + #logger.debug('timeout') logger.error('errors. disconnect') self.start_or_stopVPN() # is stop @@ -210,12 +218,12 @@ class EIPConductorAppMixin(object): if self.debugmode: self.startStopButton.setText('&Disconnect') self.eip_service_started = True + self.toggleEIPAct() # XXX decouple! (timer is init by icons class). # we could bring Timer Init to this Mixin # or to its own Mixin. self.timer.start(constants.TIMER_MILLISECONDS) - return if self.eip_service_started is True: @@ -223,5 +231,6 @@ class EIPConductorAppMixin(object): if self.debugmode: self.startStopButton.setText('&Connect') self.eip_service_started = False + self.toggleEIPAct() self.timer.stop() return |