From 9affaaacb18598fc98be669ef1c086b0afe4ad91 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 11 Feb 2016 13:34:46 -0800 Subject: [refactor] cleanup helper usage to adapt to new one also cleanups build process --- src/leap/bitmask/services/eip/darwinvpnlauncher.py | 4 +--- src/leap/bitmask/services/eip/vpnprocess.py | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'src/leap') diff --git a/src/leap/bitmask/services/eip/darwinvpnlauncher.py b/src/leap/bitmask/services/eip/darwinvpnlauncher.py index 42d9576b..f1d17698 100644 --- a/src/leap/bitmask/services/eip/darwinvpnlauncher.py +++ b/src/leap/bitmask/services/eip/darwinvpnlauncher.py @@ -54,7 +54,7 @@ class DarwinHelperCommand(object): self._connect() sock = self._sock data = "" - + command = cmd + ' ' + args + '/CMD' try: @@ -76,7 +76,6 @@ class DarwinVPNLauncher(VPNLauncher): # TODO -- move this to bitmask-helper - # Hardcode the installation path for OSX for security, openvpn is # run as root INSTALL_PATH = "/Applications/Bitmask.app/" @@ -127,7 +126,6 @@ class DarwinVPNLauncher(VPNLauncher): return os.path.join(resources_path, "bitmask.tiff") - # TODO deprecate --------------------------------------------------------- @classmethod def get_cocoasudo_ovpn_cmd(kls): diff --git a/src/leap/bitmask/services/eip/vpnprocess.py b/src/leap/bitmask/services/eip/vpnprocess.py index 6d18a599..de8d92f3 100644 --- a/src/leap/bitmask/services/eip/vpnprocess.py +++ b/src/leap/bitmask/services/eip/vpnprocess.py @@ -175,7 +175,8 @@ class VPN(object): :param kwargs: kwargs to be passed to the VPNProcess :type kwargs: dict """ - logger.debug('VPN: start ---------------------------------------------------') + logger.debug( + 'VPN: start ---------------------------------------------------') self._user_stopped = False self._stop_pollers() kwargs['openvpn_verb'] = self._openvpn_verb @@ -183,7 +184,6 @@ class VPN(object): restart = kwargs.pop('restart', False) - # FIXME it would be good to document where the # errors here are catched, since we currently handle them # at the frontend layer. This *should* move to be handled entirely @@ -206,7 +206,8 @@ class VPN(object): cmd = vpnproc.getCommand() if vpnproc.get_openvpn_process(): - logger.info("Another vpn process is running. Will try to stop it.") + logger.info( + "Another vpn process is running. Will try to stop it.") vpnproc.stop_if_already_running() # we try to bring the firewall up @@ -245,8 +246,6 @@ class VPN(object): running_proc = reactor.spawnProcess(vpnproc, cmd[0], cmd, env) vpnproc.pid = running_proc.pid self._vpnproc = vpnproc - - # add pollers for status and state # this could be extended to a collection of @@ -292,7 +291,8 @@ class VPN(object): :rtype: bool """ if IS_LINUX: - BM_ROOT = force_eval(linuxvpnlauncher.LinuxVPNLauncher.BITMASK_ROOT) + BM_ROOT = force_eval( + linuxvpnlauncher.LinuxVPNLauncher.BITMASK_ROOT) fw_up_cmd = "pkexec {0} firewall isup".format(BM_ROOT) fw_is_down = lambda: commands.getstatusoutput(fw_up_cmd)[0] == 256 return fw_is_down() @@ -303,7 +303,6 @@ class VPN(object): result = helper.send(cmd) return True - def tear_down_firewall(self): """ Tear the firewall down using the privileged wrapper. @@ -315,7 +314,8 @@ class VPN(object): return True if IS_LINUX: - BM_ROOT = force_eval(linuxvpnlauncher.LinuxVPNLauncher.BITMASK_ROOT) + BM_ROOT = force_eval( + linuxvpnlauncher.LinuxVPNLauncher.BITMASK_ROOT) exitCode = subprocess.call(["pkexec", BM_ROOT, "firewall", "stop"]) return True if exitCode is 0 else False @@ -331,7 +331,8 @@ class VPN(object): return True if IS_LINUX: - BM_ROOT = force_eval(linuxvpnlauncher.LinuxVPNLauncher.BITMASK_ROOT) + BM_ROOT = force_eval( + linuxvpnlauncher.LinuxVPNLauncher.BITMASK_ROOT) exitCode = subprocess.call(["pkexec", BM_ROOT, "openvpn", "stop"]) return True if exitCode is 0 else False -- cgit v1.2.3