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:
@@ -128,8 +128,9 @@ def main():
|
||||
state = dict(required = True, choices=['present', 'absent']),
|
||||
src = dict(default = None),
|
||||
proxy = dict(default = None)
|
||||
)
|
||||
)
|
||||
),
|
||||
supports_check_mode=True
|
||||
)
|
||||
state = module.params['state']
|
||||
name = module.params['name']
|
||||
src = module.params['src']
|
||||
@@ -146,6 +147,8 @@ def main():
|
||||
module.fail_json(name=name,
|
||||
msg="src is required when state=present")
|
||||
if not package_installed(module, name):
|
||||
if module.check_mode:
|
||||
module.exit_json(changed=True)
|
||||
(rc, out, err) = package_install(module, name, src, proxy)
|
||||
# Stdout is normally empty but for some packages can be
|
||||
# very long and is not often useful
|
||||
@@ -154,6 +157,8 @@ def main():
|
||||
|
||||
elif state == 'absent':
|
||||
if package_installed(module, name):
|
||||
if module.check_mode:
|
||||
module.exit_json(changed=True)
|
||||
(rc, out, err) = package_uninstall(module, name, src)
|
||||
out = out[:75]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user