diff options
| author | Nataliia Solomko <natalirs1985@gmail.com> | 2026-05-22 16:54:27 +0300 |
|---|---|---|
| committer | Nataliia Solomko <natalirs1985@gmail.com> | 2026-05-22 16:54:27 +0300 |
| commit | 8a537e8097ac80c696299d267e1dd1c9b6000bab (patch) | |
| tree | d2d60846907cd5643911160a9b668ffe0f72cc4f /python | |
| parent | 88b93c96faa5b1016546cbc15d1327b4692a87cc (diff) | |
| download | vyos-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 'python')
| -rw-r--r-- | python/vyos/ifconfig/wwan.py | 4 | ||||
| -rw-r--r-- | python/vyos/utils/network.py | 6 |
2 files changed, 9 insertions, 1 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 |
