summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorOded Simon <oded.simon@medibankhealth.com.au>2013-05-16 12:18:49 +1000
committerOded Simon <oded.simon@medibankhealth.com.au>2013-05-16 12:18:49 +1000
commit0ee4d8dcbf10145f319920c474053ccb747630af (patch)
tree9bd7da7df6ccdfa27aad96b812341d1cd711da76 /manifests
parentcd190e9601b62db33b6451cce3079596dadd1383 (diff)
add -i <address option to install pip packages to the exec commands
Diffstat (limited to 'manifests')
-rw-r--r--manifests/virtualenv.pp11
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,