summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-03-20 11:28:04 +0000
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-03-20 11:28:04 +0000
commitaa58a9b545ca59ab2e6c817ec0c3c8cfdbf9ce75 (patch)
treefeafd567991de130d627dd8401e7d6552846f57a /python/vyos
parent86e504525f961c461389f48f808a51df73eb337f (diff)
downloadvyos-1x-aa58a9b545ca59ab2e6c817ec0c3c8cfdbf9ce75.tar.gz
vyos-1x-aa58a9b545ca59ab2e6c817ec0c3c8cfdbf9ce75.zip
ifconfig: T2057: data conversion was lost, better error message
Diffstat (limited to 'python/vyos')
-rw-r--r--python/vyos/ifconfig/control.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/python/vyos/ifconfig/control.py b/python/vyos/ifconfig/control.py
index 508b4e279..c8568ac96 100644
--- a/python/vyos/ifconfig/control.py
+++ b/python/vyos/ifconfig/control.py
@@ -55,14 +55,17 @@ class Control:
validate = self._command_set[name].get('validate', None)
if validate:
- validate(value)
-
- config = {**config, **{'value': value}}
+ try:
+ validate(value)
+ except Exception as e:
+ raise e.__class__(f'Could not set {name}. {e}')
convert = self._command_set[name].get('convert', None)
if convert:
value = convert(value)
+ config = {**config, **{'value': value}}
+
cmd = self._command_set[name]['shellcmd'].format(**config)
return self._cmd(cmd)