From ab0b2975d4a0e390f4a32a051bb42e760157dd23 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Thu, 29 Oct 2026 17:42:55 +0100 Subject: op-mode: T9538: fix interface check in reset wireguard The CLI existence check always looked up the interface under the argument name intf_name, but reset wireguard passes it as interface. The check therefore only tested whether any WireGuard interface existed: an unconfigured name slipped through and crashed with a KeyError, or the error message reported the interface as "None". The decorator now accepts the name of the argument carrying the interface, defaulting to intf_name, so existing callers are unchanged and reset wireguard reports the unconfigured interface by name. --- python/vyos/opmode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/vyos/opmode.py b/python/vyos/opmode.py index 6c3158ee6..70a7de79e 100644 --- a/python/vyos/opmode.py +++ b/python/vyos/opmode.py @@ -329,7 +329,7 @@ def run(module): # although they may print their own warnings or status messages func(**args) -def verify_cli_exists(cli_path: list, error_msg: str=''): +def verify_cli_exists(cli_path: list, error_msg: str='', intf_key: str='intf_name'): """Decorator checks if CLI config exists using a dynamic path and error message""" def decorator(func): from functools import wraps @@ -342,7 +342,7 @@ def verify_cli_exists(cli_path: list, error_msg: str=''): from vyos.configquery import ConfigTreeQuery config = ConfigTreeQuery() - interface = kwargs.get('intf_name') + interface = kwargs.get(intf_key) # Combine the base CLI path with the specific interface name path = cli_path + [interface] if interface else cli_path -- cgit v1.2.3