mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Update various modules for check_mode
This updates the following modules to support check_mode: * apt_key * apt_repository * easy_install * pip - will always report changed due to the way it handles state * seboolean * selinux * slurp - since nothing changes, it just adds that it supports check_mode * subversion - reports changed when checking out new repo and when updating. * supervisorctl * svr4pkg See issue #2114.
This commit is contained in:
@@ -130,6 +130,7 @@ def main():
|
||||
key=dict(required=False),
|
||||
state=dict(required=False, choices=['present', 'absent'], default='present')
|
||||
),
|
||||
supports_check_mode=True
|
||||
)
|
||||
|
||||
key_id = module.params['id']
|
||||
@@ -153,6 +154,8 @@ def main():
|
||||
if key_id and key_id in keys:
|
||||
module.exit_json(changed=False)
|
||||
else:
|
||||
if module.check_mode:
|
||||
module.exit_json(changed=True)
|
||||
add_key(module, data)
|
||||
changed=False
|
||||
keys2 = all_keys(module)
|
||||
@@ -165,6 +168,8 @@ def main():
|
||||
if not key_id:
|
||||
module.fail_json(msg="key is required")
|
||||
if key_id in keys:
|
||||
if module.check_mode:
|
||||
module.exit_json(changed=True)
|
||||
if remove_key(module, key_id):
|
||||
changed=True
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user