diff options
author | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-03-20 11:28:04 +0000 |
---|---|---|
committer | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-03-20 11:28:04 +0000 |
commit | aa58a9b545ca59ab2e6c817ec0c3c8cfdbf9ce75 (patch) | |
tree | feafd567991de130d627dd8401e7d6552846f57a /python | |
parent | 86e504525f961c461389f48f808a51df73eb337f (diff) | |
download | vyos-1x-aa58a9b545ca59ab2e6c817ec0c3c8cfdbf9ce75.tar.gz vyos-1x-aa58a9b545ca59ab2e6c817ec0c3c8cfdbf9ce75.zip |
ifconfig: T2057: data conversion was lost, better error message
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/ifconfig/control.py | 9 |
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) |