Skip to content

Commit

Permalink
Allow check_mode with supports_generate_diff capability in cli_config (
Browse files Browse the repository at this point in the history
…ansible#51384)

* If network cliconf support `supports_generate_diff` in
  that case diff between running and cnadidate config
  is generated within Ansible and if check_mode is enabled
  in that case return only diff without actually invoking
  edit_config()
  • Loading branch information
ganeshrn authored Jan 29, 2019
1 parent f712e86 commit 8f5cd04
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/ansible/modules/network/cli/cli_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ def run(module, device_operations, connection, candidate, running, rollback_id):

kwargs = {'candidate': candidate, 'commit': commit, 'replace': replace,
'comment': commit_comment}
connection.edit_config(**kwargs)
if commit:
connection.edit_config(**kwargs)
result['changed'] = True

if banner_diff:
Expand All @@ -295,7 +296,8 @@ def run(module, device_operations, connection, candidate, running, rollback_id):
kwargs = {'candidate': candidate, 'commit': commit}
if multiline_delimiter:
kwargs.update({'multiline_delimiter': multiline_delimiter})
connection.edit_banner(**kwargs)
if commit:
connection.edit_banner(**kwargs)
result['changed'] = True

if module._diff:
Expand Down

0 comments on commit 8f5cd04

Please sign in to comment.