summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-11-07 22:13:25 +0100
committerChristian Breunig <christian@breunig.cc>2026-11-07 22:19:52 +0100
commitf8204635007a977141fc6a436fe2daf3e44f3084 (patch)
treeaf30ba0e4992f368a397173d805a3722c46fb472 /python
parent744ca463ba23ca6a8b79640178990c564690d6af (diff)
downloadvyos-1x-f8204635007a977141fc6a436fe2daf3e44f3084.tar.gz
vyos-1x-f8204635007a977141fc6a436fe2daf3e44f3084.zip
wwan: T9388: simplify waiting for the bearer method
Keep the polled bearer and method in plain variables via nonlocal, as the modem index lookup already does, instead of a result dict. No functional change.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/wwan.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/python/vyos/ifconfig/wwan.py b/python/vyos/ifconfig/wwan.py
index 3d64609de..4250d1472 100644
--- a/python/vyos/ifconfig/wwan.py
+++ b/python/vyos/ifconfig/wwan.py
@@ -69,19 +69,16 @@ class WWANIf(Interface):
# A bearer can report "connected" before its ipv4-config/ipv6-config
# is populated over D-Bus - retry briefly rather than mistaking that
# delay for "no static config".
- result = {}
+ bearer = method = None
def _ready():
- result['bearer'] = self._get_active_bearer()
- result['method'] = (
- dict_search(f'bearer.{family}-config.method', result['bearer'])
- if result['bearer']
- else None
- )
- return result['method'] not in (None, '', '--')
+ nonlocal bearer, method
+ bearer = self._get_active_bearer()
+ method = dict_search(f'bearer.{family}-config.method', bearer)
+ return method not in (None, '', '--')
wait_for(_ready, interval=0.5, timeout=5)
- return result['bearer'], result['method']
+ return bearer, method
def add_addr(self, addr: str, vrf_changed: bool = False) -> bool:
if addr not in ('dhcp', 'dhcpv6'):