Merge pull request #8209 from hacosta/hacosta_7300
Add check_mode support to authorized_key. Fixes #7300
This commit is contained in:
commit
dc262a0169
1 changed files with 7 additions and 1 deletions
|
@ -388,8 +388,13 @@ def enforce_state(module, params):
|
||||||
do_write = True
|
do_write = True
|
||||||
|
|
||||||
if do_write:
|
if do_write:
|
||||||
|
if module.check_mode:
|
||||||
|
module.exit_json(changed=True)
|
||||||
writekeys(module, keyfile(module, user, do_write, path, manage_dir), existing_keys)
|
writekeys(module, keyfile(module, user, do_write, path, manage_dir), existing_keys)
|
||||||
params['changed'] = True
|
params['changed'] = True
|
||||||
|
else:
|
||||||
|
if module.check_mode:
|
||||||
|
module.exit_json(changed=False)
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
@ -404,7 +409,8 @@ def main():
|
||||||
state = dict(default='present', choices=['absent','present']),
|
state = dict(default='present', choices=['absent','present']),
|
||||||
key_options = dict(required=False, type='str'),
|
key_options = dict(required=False, type='str'),
|
||||||
unique = dict(default=False, type='bool'),
|
unique = dict(default=False, type='bool'),
|
||||||
)
|
),
|
||||||
|
supports_check_mode=True
|
||||||
)
|
)
|
||||||
|
|
||||||
results = enforce_state(module, module.params)
|
results = enforce_state(module, module.params)
|
||||||
|
|
Loading…
Reference in a new issue