summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2026-05-25 18:04:46 +0300
committerGitHub <noreply@github.com>2026-05-25 18:04:46 +0300
commit85872cc0de6ef92d3e36f328c0e9a357ddfbb605 (patch)
tree6fdc12eb619911258c881324cf5093323829d8ee
parentdc47f550e908eb4252ab2a30791b851403a3feae (diff)
parent8a537e8097ac80c696299d267e1dd1c9b6000bab (diff)
downloadvyos-1x-85872cc0de6ef92d3e36f328c0e9a357ddfbb605.tar.gz
vyos-1x-85872cc0de6ef92d3e36f328c0e9a357ddfbb605.zip
Merge pull request #5216 from natali-rs1985/T8412
wwan: T8412: Fix commit failure when modem is absent or not connected
-rw-r--r--python/vyos/ifconfig/wwan.py4
-rw-r--r--python/vyos/utils/network.py6
-rwxr-xr-xsrc/conf_mode/interfaces_wwan.py8
3 files changed, 16 insertions, 2 deletions
diff --git a/python/vyos/ifconfig/wwan.py b/python/vyos/ifconfig/wwan.py
index 2b5714b85..ffd3d0a67 100644
--- a/python/vyos/ifconfig/wwan.py
+++ b/python/vyos/ifconfig/wwan.py
@@ -26,6 +26,10 @@ class WWANIf(Interface):
},
}
+ def _create(self):
+ # we can not create this interface as it is managed by the Kernel
+ pass
+
def remove(self):
"""
Remove interface from config. Removing the interface deconfigures all
diff --git a/python/vyos/utils/network.py b/python/vyos/utils/network.py
index f20450a5f..8985224f3 100644
--- a/python/vyos/utils/network.py
+++ b/python/vyos/utils/network.py
@@ -238,7 +238,11 @@ def is_wwan_connected(interface):
modem = interface.lstrip('wwan')
- tmp = cmd(f'mmcli --modem {modem} --output-json')
+ try:
+ tmp = cmd(f'mmcli --modem {modem} --output-json')
+ except OSError:
+ return False
+
tmp = loads(tmp)
# return True/False if interface is in connected state
diff --git a/src/conf_mode/interfaces_wwan.py b/src/conf_mode/interfaces_wwan.py
index 166b857a8..ad6c806ad 100755
--- a/src/conf_mode/interfaces_wwan.py
+++ b/src/conf_mode/interfaces_wwan.py
@@ -149,9 +149,15 @@ def apply(wwan):
modem = wwan['ifname'].lstrip('wwan')
base_cmd = f'mmcli --modem {modem}'
# Number of bearers is limited - always disconnect first
- cmd(f'{base_cmd} --simple-disconnect')
+ call(f'{base_cmd} --simple-disconnect')
w = WWANIf(wwan['ifname'])
+
+ # We cannot proceed with the configuration if the modem is not detected - so we bail out
+ # and wait for the next cronjob run to re-apply the configuration.
+ if not w.exists(wwan['ifname']):
+ return None
+
if 'deleted' in wwan or 'disable' in wwan:
w.remove()