From 8ebd7753c8e91bd1db032220fd0c5295947d64f0 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Mon, 14 Aug 2017 20:43:56 -0400 Subject: [bug] fix attribute error when vpn is not started --- src/leap/bitmask/vpn/_control.py | 6 ++++-- src/leap/bitmask/vpn/service.py | 4 +--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/leap/bitmask/vpn/_control.py b/src/leap/bitmask/vpn/_control.py index ac683a2a..45d2f2f4 100644 --- a/src/leap/bitmask/vpn/_control.py +++ b/src/leap/bitmask/vpn/_control.py @@ -119,11 +119,13 @@ class VPNControl(object): # We assume that the only valid stops are initiated # by an user action, not hard restarts self._user_stopped = not restart - self._vpnproc.restarting = restart + if self._vpnproc is not None: + self._vpnproc.restarting = restart self._stop_pollers() try: - self._vpnproc.preDown() + if self._vpnproc is not None: + self._vpnproc.preDown() except Exception as e: self.log.error('Error on vpn pre-down {0!r}'.format(e)) raise diff --git a/src/leap/bitmask/vpn/service.py b/src/leap/bitmask/vpn/service.py index 7cd595a0..704bbc71 100644 --- a/src/leap/bitmask/vpn/service.py +++ b/src/leap/bitmask/vpn/service.py @@ -124,9 +124,7 @@ class VPNService(HookableService): self.log.error("Firewall: error stopping") if not self._tunnel: - # XXX this avoids to shutdown anything that was in process. - # or self._tunnel.status['status'] is not 'on': - raise Exception('VPN was not running') + return {'result': 'VPN was not running'} vpn_ok = self._tunnel.stop() if not vpn_ok: -- cgit v1.2.3