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:
Nathaniel Case 2017-04-27 11:08:37 -04:00 committed by GitHub
commit fc0bf87c20
3 changed files with 65 additions and 12 deletions

View file

@ -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)