diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-10-29 17:42:55 +0100 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2026-10-29 17:42:55 +0100 |
| commit | ab0b2975d4a0e390f4a32a051bb42e760157dd23 (patch) | |
| tree | 621b0861306b88cc8905fde516392ec4fe14cc5b /python | |
| parent | fe7a0394f86591695b6f461d42a71c520d053dd9 (diff) | |
| download | vyos-1x-ab0b2975d4a0e390f4a32a051bb42e760157dd23.tar.gz vyos-1x-ab0b2975d4a0e390f4a32a051bb42e760157dd23.zip | |
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.
Diffstat (limited to 'python')
| -rw-r--r-- | python/vyos/opmode.py | 4 |
1 files changed, 2 insertions, 2 deletions
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 |
