summaryrefslogtreecommitdiff
path: root/manifests/virtualenv.pp
diff options
context:
space:
mode:
authorSergey Stankevich <sergey@stankevi.ch>2012-11-06 13:01:55 -0800
committerSergey Stankevich <sergey@stankevi.ch>2012-11-06 13:01:55 -0800
commit94d9ca52b531c76949bddfe45c5402ecb2586ab8 (patch)
tree2779f2eb95a79a071bdee02fd4bc09f053bfea6d /manifests/virtualenv.pp
parent91b595de937e938807d942d650dde3cd5f45f2ec (diff)
parente7f975a20639d1e3adbfa85f956485238c040506 (diff)
Merge pull request #2 from mfournier/gunicorn_and_virtualenv_additions
Gunicorn and virtualenv additions
Diffstat (limited to 'manifests/virtualenv.pp')
-rw-r--r--manifests/virtualenv.pp16
1 files changed, 14 insertions, 2 deletions
diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp
index f22f4e1..e816468 100644
--- a/manifests/virtualenv.pp
+++ b/manifests/virtualenv.pp
@@ -16,6 +16,9 @@
# [*proxy*]
# Proxy server to use for outbound connections. Default: none
#
+# [*systempkgs*]
+# Copy system site-packages into virtualenv. Default: don't
+#
# === Examples
#
# python::virtualenv { '/var/www/project1':
@@ -23,17 +26,21 @@
# version => 'system',
# requirements => '/var/www/project1/requirements.txt',
# proxy => 'http://proxy.domain.com:3128',
+# systempkgs => true,
# }
#
# === Authors
#
# Sergey Stankevich
+# Ashley Penney
+# Marc Fournier
#
define python::virtualenv (
$ensure = present,
$version = 'system',
$requirements = false,
- $proxy = false
+ $proxy = false,
+ $systempkgs = false,
) {
$venv_dir = $name
@@ -55,10 +62,15 @@ define python::virtualenv (
default => "&& export http_proxy=${proxy}",
}
+ $system_pkgs_flag = $systempkgs ? {
+ false => '',
+ default => '--system-site-packages',
+ }
+
exec { "python_virtualenv_${venv_dir}":
command => "mkdir -p ${venv_dir} \
${proxy_command} \
- && virtualenv -p `which ${python}` ${venv_dir} \
+ && virtualenv -p `which ${python}` ${system_pkgs_flag} ${venv_dir} \
&& ${venv_dir}/bin/pip install ${proxy_flag} --upgrade distribute pip",
creates => $venv_dir,
}