summaryrefslogtreecommitdiff
path: root/python/vyos/configverify.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos/configverify.py')
-rw-r--r--python/vyos/configverify.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py
index 137eb9f79..2ab3cb408 100644
--- a/python/vyos/configverify.py
+++ b/python/vyos/configverify.py
@@ -243,10 +243,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):
"""
@@ -256,9 +256,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):
"""
@@ -284,15 +284,16 @@ def verify_source_interface(config):
raise ConfigError('Specified source-interface {source_interface} does '
'not exist'.format(**config))
+ src_ifname = config['source_interface']
if 'source_interface_is_bridge_member' in config:
- raise ConfigError('Invalid source-interface {source_interface}. Interface '
- 'is already a member of bridge '
- '{source_interface_is_bridge_member}'.format(**config))
+ bridge_name = next(iter(config['source_interface_is_bridge_member']))
+ raise ConfigError(f'Invalid source-interface "{src_ifname}". Interface '
+ f'is already a member of bridge "{bridge_name}"!')
if 'source_interface_is_bond_member' in config:
- raise ConfigError('Invalid source-interface {source_interface}. Interface '
- 'is already a member of bond '
- '{source_interface_is_bond_member}'.format(**config))
+ bond_name = next(iter(config['source_interface_is_bond_member']))
+ raise ConfigError(f'Invalid source-interface "{src_ifname}". Interface '
+ f'is already a member of bond "{bond_name}"!')
def verify_dhcpv6(config):
"""