code cleanup for --diff and --check modes (#33665)

* code cleanup for `--diff` and `--check` modes

* fixes UT to remove exec_command
This commit is contained in:
Kedar Kekan 2017-12-07 20:14:57 +05:30 committed by GitHub
parent 4d67cdd1f7
commit 012a96dabd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 68 additions and 55 deletions

View file

@ -400,8 +400,10 @@ def main():
result['warnings'] = warnings
if commands:
if not module.check_mode:
load_config(module, commands, result['warnings'], commit=True)
commit = not module.check_mode
diff = load_config(module, commands, commit=commit)
if diff:
result['diff'] = dict(prepared=diff)
result['changed'] = True
failed_conditions = check_declarative_intent_params(module, want, result)