mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
Run save inside config mode. (#23977)
* Run `save` before exiting config mode. * Fix unit tests for `save` * Allow `save` to be on its own again and introspect success * Introspecting `compare running` makes this a lot harder. Move `save` tests to integration tests
This commit is contained in:
@@ -269,9 +269,11 @@ def main():
|
||||
run(module, result)
|
||||
|
||||
if module.params['save']:
|
||||
if not module.check_mode:
|
||||
run_commands(module, ['save'])
|
||||
result['changed'] = True
|
||||
diff = run_commands(module, commands=['configure', 'compare saved'])[1]
|
||||
if diff != '[edit]':
|
||||
run_commands(module, commands=['save'])
|
||||
result['changed'] = True
|
||||
run_commands(module, commands=['exit'])
|
||||
|
||||
module.exit_json(**result)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user