From 29a7078648abace564621a36a87eaad46528684d Mon Sep 17 00:00:00 2001 From: Ruben Herold Date: Tue, 11 Aug 2026 22:18:43 +0200 Subject: 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. --- python/vyos/utils/network.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'python') 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: -- cgit v1.2.3