diff options
author | Ruben Pollan <meskio@sindominio.net> | 2017-03-17 00:34:12 +0100 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2017-03-17 00:42:13 +0100 |
commit | 09bf881b4f457f731c5a49e88822bc731eda2c96 (patch) | |
tree | 1c164fd3381cfe68d05a5f09f7f52f3756615b5a /src/leap/bitmask/util.py | |
parent | 4fe2ad820ab46f522682bcaece55a400c7038378 (diff) |
[feat] report the real status of the VPN
Diffstat (limited to 'src/leap/bitmask/util.py')
-rw-r--r-- | src/leap/bitmask/util.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/leap/bitmask/util.py b/src/leap/bitmask/util.py index 3a7bacd2..05f1c5b3 100644 --- a/src/leap/bitmask/util.py +++ b/src/leap/bitmask/util.py @@ -45,6 +45,33 @@ def here(module=None): return dirname(__file__) +def merge_status(children): + + def key(service): + status = children[service] + level = { + "on": 0, + "off": 1, + "starting": 10, + "stopping": 11, + "failure": 100 + } + return level.get(status["status"], -1) + + service = max(children, key=key) + + status = children[service]["status"] + error = children[service]["error"] + + res = {} + for s in children.values(): + res.update(s) + res['status'] = status + res['error'] = error + res['childrenStatus'] = children + return res + + def get_gpg_bin_path(): """ Return the path to gpg binary. |