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-03 09:17:40 +0200
commit07c3bb021d77164ef5f7a4e02b869ea4c11da971 (patch)
treed41c60966594d5014c30fbd875cc8de0bfce64c8 /python
parentadda3d86080bb3b8fe26424c7d829e40eb9e2b23 (diff)
downloadvyos-1x-07c3bb021d77164ef5f7a4e02b869ea4c11da971.tar.gz
vyos-1x-07c3bb021d77164ef5f7a4e02b869ea4c11da971.zip
wwan: T4324: is_wwan_connected() must verify if ModemManager is running
(cherry picked from commit 15c94a8706622927850eba8c22fcff2df32978b4)
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 b5d81fba5..fb405166e 100644
--- a/python/vyos/util.py
+++ b/python/vyos/util.py
@@ -797,6 +797,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')