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:
Stephen Fromm
2013-02-27 12:23:35 -08:00
parent 0342b054fd
commit 8f0d8a8546
10 changed files with 58 additions and 9 deletions

View File

@@ -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)