Adding stderr regex catch for iosxr commit failures. Adding error handling after executing commit command. (#26462)
This commit is contained in:
parent
895e6c5d06
commit
e785cc53db
2 changed files with 5 additions and 1 deletions
|
@ -137,6 +137,9 @@ def load_config(module, commands, warnings, commit=False, replace=False, comment
|
|||
else:
|
||||
cmd = 'abort'
|
||||
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')
|
||||
|
|
|
@ -42,6 +42,7 @@ class TerminalModule(TerminalBase):
|
|||
re.compile(br"connection timed out", re.I),
|
||||
re.compile(br"[^\r\n]+ not found", re.I),
|
||||
re.compile(br"'[^']' +returned error code: ?\d+"),
|
||||
re.compile(br"Failed to commit", re.I)
|
||||
]
|
||||
|
||||
def on_open_shell(self):
|
||||
|
|
Loading…
Reference in a new issue