mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 13:50:22 -07:00
Fix junos_netconf integration test failure (#27528)
This commit is contained in:
parent
0b9a78f0b3
commit
7cf4416c9c
1 changed files with 8 additions and 12 deletions
|
@ -161,11 +161,12 @@ def load_config(module, config, commit=False):
|
||||||
exec_command(module, 'top')
|
exec_command(module, 'top')
|
||||||
rc, diff, err = exec_command(module, 'show | compare')
|
rc, diff, err = exec_command(module, 'show | compare')
|
||||||
|
|
||||||
if commit:
|
if diff:
|
||||||
exec_command(module, 'commit and-quit')
|
if commit:
|
||||||
else:
|
exec_command(module, 'commit and-quit')
|
||||||
for cmd in ['rollback 0', 'exit']:
|
else:
|
||||||
exec_command(module, cmd)
|
for cmd in ['rollback 0', 'exit']:
|
||||||
|
exec_command(module, cmd)
|
||||||
|
|
||||||
return str(diff).strip()
|
return str(diff).strip()
|
||||||
|
|
||||||
|
@ -196,16 +197,11 @@ def main():
|
||||||
|
|
||||||
if commands:
|
if commands:
|
||||||
commit = not module.check_mode
|
commit = not module.check_mode
|
||||||
diff = load_config(module, commands)
|
diff = load_config(module, commands, commit=commit)
|
||||||
if diff:
|
if diff:
|
||||||
if commit:
|
|
||||||
commit_configuration(module)
|
|
||||||
else:
|
|
||||||
discard_changes(module)
|
|
||||||
result['changed'] = True
|
|
||||||
|
|
||||||
if module._diff:
|
if module._diff:
|
||||||
result['diff'] = {'prepared': diff}
|
result['diff'] = {'prepared': diff}
|
||||||
|
result['changed'] = True
|
||||||
|
|
||||||
module.exit_json(**result)
|
module.exit_json(**result)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue