Don't fial if virtualenv is not installed and we do not need to initialize the virtualenv
Fixes #688
This commit is contained in:
parent
f90da6b2ba
commit
52bcf4a195
1 changed files with 9 additions and 7 deletions
|
@ -98,7 +98,7 @@ options:
|
||||||
required: false
|
required: false
|
||||||
default: null
|
default: null
|
||||||
notes:
|
notes:
|
||||||
- Please note that virtualenv (U(http://www.virtualenv.org/)) must be installed on the remote host if the virtualenv parameter is specified.
|
- Please note that virtualenv (U(http://www.virtualenv.org/)) must be installed on the remote host if the virtualenv parameter is specified and the virtualenv needs to be initialized.
|
||||||
requirements: [ "virtualenv", "pip" ]
|
requirements: [ "virtualenv", "pip" ]
|
||||||
author: Matt Wright
|
author: Matt Wright
|
||||||
'''
|
'''
|
||||||
|
@ -252,12 +252,14 @@ def main():
|
||||||
|
|
||||||
if env:
|
if env:
|
||||||
env = os.path.expanduser(env)
|
env = os.path.expanduser(env)
|
||||||
virtualenv = os.path.expanduser(virtualenv_command)
|
|
||||||
if os.path.basename(virtualenv) == virtualenv:
|
|
||||||
virtualenv = module.get_bin_path(virtualenv_command, True)
|
|
||||||
if not os.path.exists(os.path.join(env, 'bin', 'activate')):
|
if not os.path.exists(os.path.join(env, 'bin', 'activate')):
|
||||||
if module.check_mode:
|
if module.check_mode:
|
||||||
module.exit_json(changed=True)
|
module.exit_json(changed=True)
|
||||||
|
|
||||||
|
virtualenv = os.path.expanduser(virtualenv_command)
|
||||||
|
if os.path.basename(virtualenv) == virtualenv:
|
||||||
|
virtualenv = module.get_bin_path(virtualenv_command, True)
|
||||||
|
|
||||||
if module.params['virtualenv_site_packages']:
|
if module.params['virtualenv_site_packages']:
|
||||||
cmd = '%s --system-site-packages %s' % (virtualenv, env)
|
cmd = '%s --system-site-packages %s' % (virtualenv, env)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue