summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-04-01 22:30:53 +0200
committerChristian Poessinger <christian@poessinger.com>2022-04-01 22:30:53 +0200
commit15c94a8706622927850eba8c22fcff2df32978b4 (patch)
tree775c274d5e417f593a3b2c9361ca2a33ed93c452 /python
parentc6fcab97ed5c73529d043ac6a2540ab7d06759f0 (diff)
downloadvyos-1x-15c94a8706622927850eba8c22fcff2df32978b4.tar.gz
vyos-1x-15c94a8706622927850eba8c22fcff2df32978b4.zip
wwan: T4324: is_wwan_connected() must verify if ModemManager is running
Diffstat (limited to 'python')
-rw-r--r--python/vyos/util.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py
index f3f323c34..0bf6b699e 100644
--- a/python/vyos/util.py
+++ b/python/vyos/util.py
@@ -989,6 +989,11 @@ def is_wwan_connected(interface):
if not interface.startswith('wwan'):
raise ValueError(f'Specified interface "{interface}" is not a WWAN interface')
+ # ModemManager is required for connection(s) - if service is not running,
+ # there won't be any connection at all!
+ if not is_systemd_service_active('ModemManager.service'):
+ return False
+
modem = interface.lstrip('wwan')
tmp = cmd(f'mmcli --modem {modem} --output-json')