mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-05-07 05:43:04 +00:00
authorized_keys - consistent behavior in check_mode
Previously check_mode would incorrectly return changed=False even when a change would have taken place if ran without check_mode, with integration tests that confirmed this incorrect behavior. Also the module did not correctly populate the return values when run in check_mode. Both of these issues are resolved in this PR. Fixes https://github.com/ansible-collections/ansible.posix/issues/37 Signed-off-by: Adam Miller <admiller@redhat.com>
This commit is contained in:
@@ -635,13 +635,9 @@ def enforce_state(module, params):
|
||||
}
|
||||
params['diff'] = diff
|
||||
|
||||
if module.check_mode:
|
||||
module.exit_json(changed=True, diff=diff)
|
||||
writefile(module, filename, new_content)
|
||||
if not module.check_mode:
|
||||
writefile(module, filename, new_content)
|
||||
params['changed'] = True
|
||||
else:
|
||||
if module.check_mode:
|
||||
module.exit_json(changed=False)
|
||||
|
||||
return params
|
||||
|
||||
|
||||
Reference in New Issue
Block a user