args = ["-c", command]
return self._call(args, stdin, stdout, stderr)
- def __call__(self, command):
+ def __call__(self, command, stdouts=None):
"""
Call a CLI command (e.g. "show running-config")
proc = self._call_cmd(command, stdout=subprocess.PIPE)
stdout, stderr = proc.communicate()
if proc.wait() != 0:
+ if stdouts is not None:
+ stdouts.append(stdout.decode('UTF-8'))
raise VtyshException(
'vtysh returned status %d for command "%s"' % (proc.returncode, command)
)
# frr(config-if)# no ip ospf authentication
# frr(config-if)#
+ stdouts = []
while True:
try:
- vtysh(["configure"] + cmd)
+ vtysh(["configure"] + cmd, stdouts)
except VtyshException:
'"%s" we failed to remove this command',
" -- ".join(original_cmd),
)
+ # Log first error msg for original_cmd
+ if stdouts:
+ log.error(stdouts[0])
reload_ok = False
break