summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNataliia Solomko <natalirs1985@gmail.com>2026-05-22 16:54:27 +0300
committerNataliia Solomko <natalirs1985@gmail.com>2026-05-22 16:54:27 +0300
commit8a537e8097ac80c696299d267e1dd1c9b6000bab (patch)
treed2d60846907cd5643911160a9b668ffe0f72cc4f /src
parent88b93c96faa5b1016546cbc15d1327b4692a87cc (diff)
downloadvyos-1x-8a537e8097ac80c696299d267e1dd1c9b6000bab.tar.gz
vyos-1x-8a537e8097ac80c696299d267e1dd1c9b6000bab.zip
wwan: T8412: Fix commit failure when modem is absent or not connected
`mmcli --simple-disconnect` can be called when the modem bearer is not active. This causes cmd() to raise a `PermissionError` and abort the commit. Handle the case gracefully so the configuration can be committed before the modem is physically present or fully connected.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/interfaces_wwan.py8
1 files changed, 7 insertions, 1 deletions
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()