Skip to content

Commit

Permalink
Adding stderr regex catch for iosxr commit failures. Adding error han…
Browse files Browse the repository at this point in the history
…dling after executing commit command. (ansible#26462)
  • Loading branch information
jmighion authored and ganeshrn committed Jul 6, 2017
1 parent 895e6c5 commit e785cc5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/ansible/module_utils/iosxr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
1 change: 1 addition & 0 deletions lib/ansible/plugins/terminal/iosxr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit e785cc5

Please sign in to comment.