diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-08-01 17:27:59 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2022-08-01 17:30:30 +0200 |
commit | 8c10a12251533c9e8f00d2f52dc5d23f8bb9a3ae (patch) | |
tree | 25811971b012394ef6baedb962f7ca70c0546f90 | |
parent | 9d0ca97cc0f1b38d1b677e3c77ab0da8f32e54df (diff) | |
download | vyos-1x-8c10a12251533c9e8f00d2f52dc5d23f8bb9a3ae.tar.gz vyos-1x-8c10a12251533c9e8f00d2f52dc5d23f8bb9a3ae.zip |
bridge: T4565: bugfix error message when member interface contains an address
We should not print the entire dictionary - we only need the bridge interface
name:
Bug:
Cannot assign address to interface "eth1" as it is a member of bridge
"{'br0': {'allowed_vlan': ['5-50', '101'], 'native_vlan': '101'}}"!
Fixed:
Cannot assign address to interface "eth1" as it is a member of bridge
"br0"!
(cherry picked from commit 71f2f2d789bd3452ca7b5306f39df5f6537bfef0)
-rw-r--r-- | python/vyos/configverify.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py index 44342f289..356246053 100644 --- a/python/vyos/configverify.py +++ b/python/vyos/configverify.py @@ -196,10 +196,10 @@ def verify_address(config): of a bridge or bond. """ if {'is_bridge_member', 'address'} <= set(config): - raise ConfigError( - 'Cannot assign address to interface "{ifname}" as it is a ' - 'member of bridge "{is_bridge_member}"!'.format(**config)) - + interface = config['ifname'] + bridge_name = next(iter(config['is_bridge_member'])) + raise ConfigError(f'Cannot assign address to interface "{interface}" ' + f'as it is a member of bridge "{bridge_name}"!') def verify_bridge_delete(config): """ @@ -209,9 +209,9 @@ def verify_bridge_delete(config): """ if 'is_bridge_member' in config: interface = config['ifname'] - for bridge in config['is_bridge_member']: - raise ConfigError(f'Interface "{interface}" cannot be deleted as it ' - f'is a member of bridge "{bridge}"!') + bridge_name = next(iter(config['is_bridge_member'])) + raise ConfigError(f'Interface "{interface}" cannot be deleted as it ' + f'is a member of bridge "{bridge_name}"!') def verify_interface_exists(ifname): """ |