mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fix diff precedence cli_config module (#44295)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
aed6722fbc
commit
899eddf9e4
1 changed files with 19 additions and 19 deletions
|
@ -207,7 +207,25 @@ def run(module, capabilities, connection, candidate, running):
|
||||||
elif replace in ('no', 'false', 'False'):
|
elif replace in ('no', 'false', 'False'):
|
||||||
replace = False
|
replace = False
|
||||||
|
|
||||||
if capabilities['device_operations']['supports_generate_diff']:
|
if capabilities['device_operations']['supports_onbox_diff']:
|
||||||
|
if diff_replace:
|
||||||
|
module.warn('diff_replace is ignored as the device supports onbox diff')
|
||||||
|
if diff_match:
|
||||||
|
module.warn('diff_mattch is ignored as the device supports onbox diff')
|
||||||
|
if diff_ignore_lines:
|
||||||
|
module.warn('diff_ignore_lines is ignored as the device supports onbox diff')
|
||||||
|
|
||||||
|
if not isinstance(candidate, list):
|
||||||
|
candidate = candidate.strip('\n').splitlines()
|
||||||
|
|
||||||
|
kwargs = {'candidate': candidate, 'commit': commit, 'replace': replace,
|
||||||
|
'comment': commit_comment}
|
||||||
|
resp = connection.edit_config(**kwargs)
|
||||||
|
|
||||||
|
if 'diff' in resp:
|
||||||
|
result['changed'] = True
|
||||||
|
|
||||||
|
elif capabilities['device_operations']['supports_generate_diff']:
|
||||||
kwargs = {'candidate': candidate, 'running': running}
|
kwargs = {'candidate': candidate, 'running': running}
|
||||||
if diff_match:
|
if diff_match:
|
||||||
kwargs.update({'diff_match': diff_match})
|
kwargs.update({'diff_match': diff_match})
|
||||||
|
@ -241,24 +259,6 @@ def run(module, capabilities, connection, candidate, running):
|
||||||
connection.edit_banner(**kwargs)
|
connection.edit_banner(**kwargs)
|
||||||
result['changed'] = True
|
result['changed'] = True
|
||||||
|
|
||||||
elif capabilities['device_operations']['supports_onbox_diff']:
|
|
||||||
if diff_replace:
|
|
||||||
module.warn('diff_replace is ignored as the device supports onbox diff')
|
|
||||||
if diff_match:
|
|
||||||
module.warn('diff_mattch is ignored as the device supports onbox diff')
|
|
||||||
if diff_ignore_lines:
|
|
||||||
module.warn('diff_ignore_lines is ignored as the device supports onbox diff')
|
|
||||||
|
|
||||||
if not isinstance(candidate, list):
|
|
||||||
candidate = candidate.strip('\n').splitlines()
|
|
||||||
|
|
||||||
kwargs = {'candidate': candidate, 'commit': commit, 'replace': replace,
|
|
||||||
'comment': commit_comment}
|
|
||||||
resp = connection.edit_config(**kwargs)
|
|
||||||
|
|
||||||
if 'diff' in resp:
|
|
||||||
result['changed'] = True
|
|
||||||
|
|
||||||
if module._diff:
|
if module._diff:
|
||||||
if 'diff' in resp:
|
if 'diff' in resp:
|
||||||
result['diff'] = {'prepared': resp['diff']}
|
result['diff'] = {'prepared': resp['diff']}
|
||||||
|
|
Loading…
Add table
Reference in a new issue