diff options
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/ifconfig/control.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/python/vyos/ifconfig/control.py b/python/vyos/ifconfig/control.py index c8568ac96..635b626e8 100644 --- a/python/vyos/ifconfig/control.py +++ b/python/vyos/ifconfig/control.py @@ -29,12 +29,13 @@ class Control: def _cmd(self, command): p = Popen(command, stdout=PIPE, stderr=STDOUT, shell=True) tmp = p.communicate()[0].strip() - self._debug_msg("cmd '{}'".format(command)) - if tmp.decode(): - self._debug_msg("returned:\n{}".format(tmp.decode())) - - # do we need some error checking code here? - return tmp.decode() + self._debug_msg(f"cmd '{command}'") + decoded = tmp.decode() + if decoded: + self._debug_msg(f"returned:\n{decoded}") + if p.returncode != 0: + raise RuntimeError(f'{command}\nreturned: {decoded}') + return decoded def _get_command(self, config, name): """ |