summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJernej Jakob <jernej.jakob@gmail.com>2020-05-01 19:48:48 +0200
committerJernej Jakob <jernej.jakob@gmail.com>2020-05-04 22:59:39 +0200
commitee58d8ef363d989ab7c63441b84489a6c45cfc31 (patch)
tree3c2722c2a0891852f185a90ff21d1cdccef0963b
parentf45c165ca53d4c9e8017d36940de768d7419e097 (diff)
downloadvyos-1x-ee58d8ef363d989ab7c63441b84489a6c45cfc31.tar.gz
vyos-1x-ee58d8ef363d989ab7c63441b84489a6c45cfc31.zip
pseudo-ethernet: T2241: cleanup verify section
- make error output more user friendly - replace .format with f-strings - split into lines less than ~80 characters long
-rwxr-xr-xsrc/conf_mode/interfaces-pseudo-ethernet.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/conf_mode/interfaces-pseudo-ethernet.py b/src/conf_mode/interfaces-pseudo-ethernet.py
index bd0942fd8..1d04d6dbe 100755
--- a/src/conf_mode/interfaces-pseudo-ethernet.py
+++ b/src/conf_mode/interfaces-pseudo-ethernet.py
@@ -110,17 +110,19 @@ def get_config():
def verify(peth):
if peth['deleted']:
if peth['is_bridge_member']:
- interface = peth['intf']
- bridge = peth['is_bridge_member']
- raise ConfigError(f'Interface "{interface}" can not be deleted as it belongs to bridge "{bridge}"!')
+ raise ConfigError((
+ f'Cannot delete interface "{peth["intf"]}" as it is a '
+ f'member of bridge "{peth["is_bridge_member"]}"!'))
return None
if not peth['source_interface']:
- raise ConfigError('source-interface must be set for virtual ethernet {}'.format(peth['intf']))
+ raise ConfigError((
+ f'Link device must be set for pseudo-ethernet "{peth["intf"]}"'))
if not peth['source_interface'] in interfaces():
- raise ConfigError('Pseudo-ethernet source-interface does not exist')
+ raise ConfigError((
+ f'Pseudo-ethernet "{peth["intf"]}" link device does not exist')
if ( peth['is_bridge_member']
and ( peth['address']