From 48257bd03d792188931f79b4239525725b322c09 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Thu, 8 Feb 2018 01:23:36 +0100 Subject: [bug] fail gracefully if we do not have mail deps --- src/leap/bitmask/core/service.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/leap/bitmask/core/service.py b/src/leap/bitmask/core/service.py index 026e51d9..c3672843 100644 --- a/src/leap/bitmask/core/service.py +++ b/src/leap/bitmask/core/service.py @@ -46,7 +46,11 @@ except ImportError as exc: backend = flags.BACKEND if backend == 'default': - from leap.bitmask.core import mail_services + try: + from leap.bitmask.core import mail_services + HAS_MAIL = True + except ImportError: + HAS_MAIL = False from leap.bitmask.bonafide.service import BonafideService elif backend == 'dummy': from leap.bitmask.core.dummy import mail_services @@ -98,10 +102,10 @@ class BitmaskBackend(configurable.ConfigurableService): on_start(self.init_bonafide) on_start(self.init_sessions) - if self._enabled('mail'): + if HAS_MAIL and self._enabled('mail'): on_start(self._init_mail_services) - if self._enabled('vpn'): + if HAS_VPN and self._enabled('vpn'): on_start(self._init_vpn) if self._enabled('zmq'): -- cgit v1.2.3