Skip to content

Commit

Permalink
Added the 'show commit config diff' output available from the IOSXR d…
Browse files Browse the repository at this point in the history
…evice (ansible#54875)
  • Loading branch information
marouim authored and justjais committed May 27, 2019
1 parent cab02b7 commit 398f4b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/ansible/module_utils/network/iosxr/iosxr.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,11 @@ def load_config(module, command_filter, commit=False, replace=False,
response = conn.edit_config(candidate=command_filter, commit=commit, admin=admin, replace=replace, comment=comment, label=label)
if module._diff:
diff = response.get('diff')

# Overwrite the default diff by the IOS XR commit diff.
# See plugins/cliconf/iosxr.py for this key set: show_commit_config_diff
diff = response.get('show_commit_config_diff')

except ConnectionError as exc:
module.fail_json(msg=to_text(exc, errors='surrogate_then_replace'))

Expand Down
5 changes: 5 additions & 0 deletions lib/ansible/plugins/cliconf/iosxr.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ def edit_config(self, candidate=None, commit=True, admin=False, replace=None, co
results.append(self.send_command(**line))
requests.append(cmd)

# Before any commit happend, we can get a real configuration
# diff from the device and make it available by the iosxr_config module.
# This information can be usefull either in check mode or normal mode.
resp['show_commit_config_diff'] = self.get('show commit changes diff')

if commit:
self.commit(comment=comment, label=label, replace=replace)
else:
Expand Down

0 comments on commit 398f4b8

Please sign in to comment.