diff options
author | Sergey Stankevich <sergey@stankevi.ch> | 2013-05-16 09:45:33 -0700 |
---|---|---|
committer | Sergey Stankevich <sergey@stankevi.ch> | 2013-05-16 09:45:33 -0700 |
commit | c3eeb5c15f83258196ac5fe1a17f5464d65c87d4 (patch) | |
tree | 9bd7da7df6ccdfa27aad96b812341d1cd711da76 | |
parent | cd190e9601b62db33b6451cce3079596dadd1383 (diff) | |
parent | 0ee4d8dcbf10145f319920c474053ccb747630af (diff) |
Merge pull request #14 from simonoded/master
adding pipindex option
-rw-r--r-- | manifests/virtualenv.pp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index ae0e847..9888cd2 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -30,6 +30,7 @@ # requirements => '/var/www/project1/requirements.txt', # proxy => 'http://proxy.domain.com:3128', # systempkgs => true, +# index => 'http://www.example.com/simple/' # } # # === Authors @@ -47,6 +48,7 @@ define python::virtualenv ( $distribute = true, $owner = 'root', $group = 'root' + $index = false, ) { $venv_dir = $name @@ -77,12 +79,17 @@ define python::virtualenv ( true => 'distribute', default => '', } + $pypi_index = $index ? { + false => '', + default => "-i ${index}", + } + exec { "python_virtualenv_${venv_dir}": command => "mkdir -p ${venv_dir} \ ${proxy_command} \ && virtualenv -p `which ${python}` ${system_pkgs_flag} ${venv_dir} \ - && ${venv_dir}/bin/pip install ${proxy_flag} --upgrade ${distribute_pkg} pip", + && ${venv_dir}/bin/pip install ${pypi_index} ${proxy_flag} --upgrade ${distribute_pkg} pip", user => $owner, creates => $venv_dir, path => [ '/bin', '/usr/bin', '/usr/sbin' ], @@ -98,7 +105,7 @@ define python::virtualenv ( if $requirements { exec { "python_requirements_initial_install_${requirements}_${venv_dir}": - command => "${venv_dir}/bin/pip install ${proxy_flag} --requirement ${requirements}", + command => "${venv_dir}/bin/pip install ${pypi_index} ${proxy_flag} --requirement ${requirements}", refreshonly => true, timeout => 1800, user => $owner, |