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:
@@ -86,7 +86,7 @@ def main():
|
||||
virtualenv_command=dict(default='virtualenv', required=False),
|
||||
)
|
||||
|
||||
module = AnsibleModule(argument_spec=arg_spec)
|
||||
module = AnsibleModule(argument_spec=arg_spec, supports_check_mode=True)
|
||||
|
||||
name = module.params['name']
|
||||
env = module.params['virtualenv']
|
||||
@@ -102,6 +102,8 @@ def main():
|
||||
virtualenv = module.get_bin_path(virtualenv_command, True)
|
||||
|
||||
if not os.path.exists(os.path.join(env, 'bin', 'activate')):
|
||||
if module.check_mode:
|
||||
module.exit_json(changed=True)
|
||||
command = '%s %s' % (virtualenv, env)
|
||||
if site_packages:
|
||||
command += ' --system-site-packages'
|
||||
@@ -116,6 +118,8 @@ def main():
|
||||
installed = _is_package_installed(module, name, easy_install)
|
||||
|
||||
if not installed:
|
||||
if module.check_mode:
|
||||
module.exit_json(changed=True)
|
||||
cmd = '%s %s' % (easy_install, name)
|
||||
rc_pip, out_pip, err_pip = module.run_command(cmd)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user