Unverified Commit 5a68ef22 authored by Kali Kaneko's avatar Kali Kaneko Committed by Kali Kaneko

[bug] fix constants import error

parent 580d4519
Pipeline #15905 passed with stages
in 83 minutes and 35 seconds
......@@ -40,6 +40,9 @@ try:
from leap.bitmask.vpn.service import VPNService
HAS_VPN = True
except ImportError as exc:
print "[!] Could not import VPN: %r" % exc
# graceful fail for mail-only builds.
# set a raise to investigate the full traceback
HAS_VPN = False
......
......@@ -27,13 +27,16 @@ from twisted.logger import Logger
from leap.bitmask.util import STANDALONE
from leap.bitmask.system import IS_MAC, IS_LINUX, IS_SNAP
from leap.bitmask.vpn.constants import BITMASK_ROOT_SYSTEM
from leap.bitmask.vpn.constants import BITMASK_ROOT_LOCAL
from leap.bitmask.vpn.constants import BITMASK_ROOT_SNAP
from leap.common.events import catalog, emit_async
from leap.bitmask.vpn.launchers import darwin
if IS_LINUX:
from leap.bitmask.vpn.constants import BITMASK_ROOT_SYSTEM
from leap.bitmask.vpn.constants import BITMASK_ROOT_LOCAL
from leap.bitmask.vpn.constants import BITMASK_ROOT_SNAP
log = Logger()
# A regular user should not run bitmask as root, but we contemplate
......@@ -90,7 +93,6 @@ class _LinuxFirewallManager(object):
exceptions.
This allows us to achieve fail close on a vpn connection.
"""
# TODO factor out choosing a version of bitmask-root.
# together with linux vpnlauncher.
......@@ -101,15 +103,19 @@ class _LinuxFirewallManager(object):
# if this is a bundle, we pick local. bundles ask to install it there.
BITMASK_ROOT = BITMASK_ROOT_LOCAL
else:
if os.path.isfile(BITMASK_ROOT_SYSTEM):
# we can be running from the debian package,
# or some other distro. it's the maintainer responsibility to put
# bitmask-root there.
BITMASK_ROOT = BITMASK_ROOT_SYSTEM
else:
# as a last case, we fall back to installing into the
# /usr/local/sbin version.
BITMASK_ROOT = BITMASK_ROOT_LOCAL
try:
if os.path.isfile(BITMASK_ROOT_SYSTEM):
# we can be running from the debian package,
# or some other distro. it's the maintainer responsibility to
# put bitmask-root there.
BITMASK_ROOT = BITMASK_ROOT_SYSTEM
else:
# as a last case, we fall back to installing into the
# /usr/local/sbin version.
BITMASK_ROOT = BITMASK_ROOT_LOCAL
except NameError:
# not defined for other platforms
pass
def __init__(self, remotes):
"""
......
......@@ -42,8 +42,8 @@ class HelperCommand(object):
self._sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try:
self._sock.connect(self.SOCKET_ADDR)
except socket.error, msg:
raise RuntimeError('Cannot connect to helper: ' + msg)
except socket.error as exc:
raise RuntimeError('Cannot connect to helper: %r' % exc)
def send(self, cmd, args=''):
self._connect()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment