diff options
author | Kali Kaneko <kali@leap.se> | 2018-02-08 01:23:36 +0100 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2018-02-15 16:36:39 +0100 |
commit | 48257bd03d792188931f79b4239525725b322c09 (patch) | |
tree | 0ddee15c0ceebcde4bef7289b0669266e7b9febe /src/leap/bitmask | |
parent | 3aaa810ccb41bff27ab17130932840eefd49fb83 (diff) |
[bug] fail gracefully if we do not have mail deps
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r-- | src/leap/bitmask/core/service.py | 10 |
1 files changed, 7 insertions, 3 deletions
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'): |