diff options
author | Kali Kaneko <kali@leap.se> | 2018-01-18 15:37:18 +0100 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2018-01-25 01:19:16 +0100 |
commit | c3306592fbb54fab0da44a8faaa8a1c6954537fd (patch) | |
tree | 0a9b406f81d33af40e1e943f0e330c28b06eb9ed /src/leap/bitmask/vpn/_checks.py | |
parent | 276c717b0d1d662cabc117cea7373418efedde09 (diff) |
[feat] report missing polkit properly from main UI
also refactor and move polkit_agent so that it does not depend on having
bitmask on the path.
Diffstat (limited to 'src/leap/bitmask/vpn/_checks.py')
-rw-r--r-- | src/leap/bitmask/vpn/_checks.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/leap/bitmask/vpn/_checks.py b/src/leap/bitmask/vpn/_checks.py index 9586d096..c9e40f57 100644 --- a/src/leap/bitmask/vpn/_checks.py +++ b/src/leap/bitmask/vpn/_checks.py @@ -18,10 +18,10 @@ class ImproperlyConfigured(Exception): def get_failure_for(provider): - if not _has_valid_cert(provider): - raise ImproperlyConfigured('Missing VPN certificate') if IS_LINUX and not is_pkexec_in_system(): raise NoPkexecAvailable() + if not _has_valid_cert(provider): + raise ImproperlyConfigured('Missing VPN certificate') def is_service_ready(provider): @@ -35,8 +35,11 @@ def is_service_ready(provider): def cert_expires(provider): path = get_vpn_cert_path(provider) - with open(path, 'r') as f: - cert = f.read() + try: + with open(path, 'r') as f: + cert = f.read() + except IOError: + return None _, to = get_cert_time_boundaries(cert) expiry_date = datetime.fromtimestamp(mktime(to)) return expiry_date |