Allow check_mode with supports_generate_diff capability in cli_config (#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()
(cherry picked from commit 8f5cd049d6
)
This commit is contained in:
parent
0d5f083a52
commit
97a3e4acc0
2 changed files with 7 additions and 2 deletions
3
changelogs/fragments/cli_config_diff_fix.yaml
Normal file
3
changelogs/fragments/cli_config_diff_fix.yaml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
minor_changes:
|
||||
- Allow check_mode with supports_generate_diff capability in cli_config. (https://github.com/ansible/ansible/pull/51417)
|
|
@ -251,7 +251,8 @@ def run(module, capabilities, connection, candidate, running):
|
|||
|
||||
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:
|
||||
|
@ -260,7 +261,8 @@ def run(module, capabilities, connection, candidate, running):
|
|||
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:
|
||||
|
|
Loading…
Add table
Reference in a new issue