Adding stderr regex catch for iosxr commit failures. Adding error handling after executing commit command. (#26462)

pull/26473/head
James Mighion 7 years ago committed by Ganesh Nalawade
parent 895e6c5d06
commit e785cc53db

@ -137,6 +137,9 @@ def load_config(module, commands, warnings, commit=False, replace=False, comment
else: else:
cmd = 'abort' cmd = 'abort'
diff = None diff = None
exec_command(module, cmd) rc, out, err = exec_command(module, cmd)
if rc != 0:
exec_command(module, 'abort')
module.fail_json(msg=err, commands=commands, rc=rc)
return to_text(diff, errors='surrogate_or_strict') return to_text(diff, errors='surrogate_or_strict')

@ -42,6 +42,7 @@ class TerminalModule(TerminalBase):
re.compile(br"connection timed out", re.I), re.compile(br"connection timed out", re.I),
re.compile(br"[^\r\n]+ not found", re.I), re.compile(br"[^\r\n]+ not found", re.I),
re.compile(br"'[^']' +returned error code: ?\d+"), re.compile(br"'[^']' +returned error code: ?\d+"),
re.compile(br"Failed to commit", re.I)
] ]
def on_open_shell(self): def on_open_shell(self):

Loading…
Cancel
Save