diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-10-11 21:49:32 +0200 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2026-10-11 21:49:32 +0200 |
| commit | f1be2782b83f79c7fb5f32d892b4b6779100819e (patch) | |
| tree | 85a491ab3d52b91f4a2eee4c45a9b40559a1d0b2 /src | |
| parent | 1748e1eff7db459bfcaa69b28862dd2740fe1745 (diff) | |
| download | vyos-1x-f1be2782b83f79c7fb5f32d892b4b6779100819e.tar.gz vyos-1x-f1be2782b83f79c7fb5f32d892b4b6779100819e.zip | |
ethernet: T9454: show CLI option names in bond member errors and warnings
Options rejected or overridden on a bond member were reported with their
internal names, e.g. "vif_s 10 vif_c 100 address". Messages now use the CLI
spelling: "vif-s 10 vif-c 100 address".
Diffstat (limited to 'src')
| -rwxr-xr-x | src/conf_mode/interfaces_ethernet.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/conf_mode/interfaces_ethernet.py b/src/conf_mode/interfaces_ethernet.py index 54af3954e..e4ac18531 100755 --- a/src/conf_mode/interfaces_ethernet.py +++ b/src/conf_mode/interfaces_ethernet.py @@ -61,6 +61,10 @@ from vyos import ConfigError from vyos import airbag airbag.enable() +def cli_path(option_path: str) -> str: + """ Undo key mangling of a dotted option path for user-facing messages """ + return option_path.replace('.', ' ').replace('_', '-') + def update_bond_options(conf: Config, eth_conf: dict) -> list: """ Return list of blocked options if interface is a bond member @@ -115,7 +119,7 @@ def update_bond_options(conf: Config, eth_conf: dict) -> list: if bond_option_value is not None: if is_node_changed(conf, eth_path_base + option_path.split('.')): Warning( - f'Cannot apply "{option_path.replace(".", " ")}" to "{option_value}".' \ + f'Cannot apply "{cli_path(option_path)}" to "{option_value}".' \ f' Interface "{eth_conf["ifname"]}" is a bond member.' \ f' Option is inherited from bond "{bond_name}"') dict_set(option_path, bond_option_value, eth_conf) @@ -125,7 +129,7 @@ def update_bond_options(conf: Config, eth_conf: dict) -> list: else: if is_node_changed(conf, eth_path_base + option_path.split('.')): Warning( - f'Cannot apply "{option_path.replace(".", " ")}".' \ + f'Cannot apply "{cli_path(option_path)}".' \ f' Interface "{eth_conf["ifname"]}" is a bond member.' \ f' Option is inherited from bond "{bond_name}"') dict_delete(option_path, eth_conf) @@ -138,7 +142,7 @@ def update_bond_options(conf: Config, eth_conf: dict) -> list: if option_path not in eth_dict_paths: if is_node_changed(conf, eth_path_base + option_path.split('.')): Warning( - f'Cannot apply "{option_path.replace(".", " ")}" to "{dict_search(option_path, config_with_defaults)}".' \ + f'Cannot apply "{cli_path(option_path)}" to "{dict_search(option_path, config_with_defaults)}".' \ f' Interface "{eth_conf["ifname"]}" is a bond member. ' \ f'Option is inherited from bond "{bond_name}"') dict_set(option_path, bond_option_value, eth_conf) @@ -424,7 +428,7 @@ def verify_allowedbond_changes(ethernet: dict): """ if 'bond_blocked_changes' in ethernet: for option in ethernet['bond_blocked_changes']: - raise ConfigError(f'Cannot configure "{option.replace(".", " ")}"' \ + raise ConfigError(f'Cannot configure "{cli_path(option)}"' \ f' on interface "{ethernet["ifname"]}".' \ f' Interface is a bond member') |
