diff options
| author | Ruben Herold <ruben@puettmann.net> | 2026-08-11 22:18:43 +0200 |
|---|---|---|
| committer | Ruben Herold <ruben@puettmann.net> | 2026-08-11 22:18:43 +0200 |
| commit | 29a7078648abace564621a36a87eaad46528684d (patch) | |
| tree | 59f82b516077babc141cef53525e6c6365f21da2 /python | |
| parent | 20022b3470eab0c7c474917a82a7453d655a9714 (diff) | |
| download | vyos-1x-29a7078648abace564621a36a87eaad46528684d.tar.gz vyos-1x-29a7078648abace564621a36a87eaad46528684d.zip | |
utils: T9177: remove unreachable raise in get_vrf_members()
The ValueError for a non-existent VRF was always immediately
swallowed by the surrounding bare except, so the raise never
propagated and only obscured the actual behavior (returning an
empty list). Check existence up front and return early instead.
Flagged by Copilot review on PR #5383.
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/utils/network.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/python/vyos/utils/network.py b/python/vyos/utils/network.py index 9eecf97f4..3a26fe193 100644 --- a/python/vyos/utils/network.py +++ b/python/vyos/utils/network.py @@ -121,9 +121,9 @@ def get_vrf_members(vrf: str) -> list: :return: list """ interfaces = [] + if not interface_exists(vrf): + return interfaces try: - if not interface_exists(vrf): - raise ValueError(f'VRF "{vrf}" does not exist!') output = cmdl(['ip', '--json', '--brief', 'link', 'show', 'vrf', vrf]) answer = loads(output) for data in answer: |
