summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/platform_init
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-08-31 14:54:52 -0400
committerKali Kaneko <kali@leap.se>2015-08-31 14:54:52 -0400
commitf4547479fc050f338845f4f546d8dd7c0e4512eb (patch)
tree0f737c7f102674230f5467ecaf17720e1d28f6eb /src/leap/bitmask/platform_init
parentdd43dad4b150adb66e571a56a8a5c053dec858d0 (diff)
parentfd27f48a35736d8ba186c423a7de15ffee5143dd (diff)
Merge tag '0.9.0rc2' into debian/experimental
Tag leap.bitmask version 0.9.0rc2
Diffstat (limited to 'src/leap/bitmask/platform_init')
-rw-r--r--src/leap/bitmask/platform_init/initializers.py6
-rw-r--r--src/leap/bitmask/platform_init/locks.py11
2 files changed, 8 insertions, 9 deletions
diff --git a/src/leap/bitmask/platform_init/initializers.py b/src/leap/bitmask/platform_init/initializers.py
index 086927dd..eb892cce 100644
--- a/src/leap/bitmask/platform_init/initializers.py
+++ b/src/leap/bitmask/platform_init/initializers.py
@@ -17,7 +17,6 @@
"""
Platform-dependant initialization code.
"""
-import logging
import os
import platform
import stat
@@ -32,9 +31,9 @@ from leap.bitmask.services.eip import get_vpn_launcher
from leap.bitmask.services.eip.darwinvpnlauncher import DarwinVPNLauncher
from leap.bitmask.util import first
from leap.bitmask.util.privilege_policies import LinuxPolicyChecker
+from leap.bitmask.logs.utils import get_logger
-
-logger = logging.getLogger(__name__)
+logger = get_logger()
# NOTE we could use a deferToThread here, but should
# be aware of this bug: http://www.themacaque.com/?p=1067
@@ -202,6 +201,7 @@ def check_polkit():
try:
LinuxPolicyChecker.maybe_pkexec()
+ return True
except Exception:
logger.error("No polkit agent running.")
diff --git a/src/leap/bitmask/platform_init/locks.py b/src/leap/bitmask/platform_init/locks.py
index ac45a5ce..203d367b 100644
--- a/src/leap/bitmask/platform_init/locks.py
+++ b/src/leap/bitmask/platform_init/locks.py
@@ -17,14 +17,13 @@
"""
Utilities for handling multi-platform file locking mechanisms
"""
-import logging
import errno
import os
import platform
+from leap.bitmask.logs.utils import get_logger
from leap.bitmask.platform_init import IS_WIN, IS_UNIX
-from leap.common.events import signal as signal_event
-from leap.common.events import events_pb2 as proto
+from leap.common.events import emit, catalog
if IS_UNIX:
from fcntl import flock, LOCK_EX, LOCK_NB
@@ -38,7 +37,7 @@ else: # WINDOWS
from leap.bitmask.util import get_modification_ts, update_modification_ts
-logger = logging.getLogger(__name__)
+logger = get_logger()
if IS_UNIX:
@@ -364,7 +363,7 @@ def we_are_the_one_and_only():
locker.get_lock()
we_are_the_one = locker.locked_by_us
if not we_are_the_one:
- signal_event(proto.RAISE_WINDOW)
+ emit(catalog.RAISE_WINDOW)
return we_are_the_one
elif IS_WIN:
@@ -385,7 +384,7 @@ def we_are_the_one_and_only():
# let's assume it's a stalled lock
we_are_the_one = True
- signal_event(proto.RAISE_WINDOW)
+ emit(catalog.RAISE_WINDOW)
while check_interval():
if get_modification_ts(lock_path) > ts: