summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md8
-rw-r--r--manifests/gunicorn.pp10
-rw-r--r--manifests/requirements.pp2
-rw-r--r--manifests/virtualenv.pp16
-rw-r--r--tests/gunicorn.pp1
-rw-r--r--tests/virtualenv.pp1
6 files changed, 33 insertions, 5 deletions
diff --git a/README.md b/README.md
index 67c9d07..6289fdb 100644
--- a/README.md
+++ b/README.md
@@ -64,11 +64,14 @@ Creates Python virtualenv.
**proxy** — Proxy server to use for outbound connections. Default: none
+**systempkgs** — Copy system site-packages into virtualenv. Default: don't
+
python::virtualenv { '/var/www/project1':
ensure => present,
version => 'system',
requirements => '/var/www/project1/requirements.txt',
proxy => 'http://proxy.domain.com:3128',
+ systempkgs => true,
}
### python::gunicorn
@@ -87,6 +90,8 @@ Manages Gunicorn virtual hosts.
**environment** — Set ENVIRONMENT variable. Default: none
+**template** — Which ERB template to use. Default: python/gunicorn.erb
+
python::gunicorn { 'vhost':
ensure => present,
virtualenv => '/var/www/project1',
@@ -94,8 +99,11 @@ Manages Gunicorn virtual hosts.
dir => '/var/www/project1/current',
bind => 'unix:/tmp/gunicorn.socket',
environment => 'prod',
+ template => 'python/gunicorn.erb',
}
## Authors
[Sergey Stankevich](https://github.com/stankevich)
+[Ashley Penney](https://github.com/apenney)
+[Marc Fournier](https://github.com/mfournier)
diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp
index 2548e95..13f4872 100644
--- a/manifests/gunicorn.pp
+++ b/manifests/gunicorn.pp
@@ -25,6 +25,9 @@
# [*environment*]
# Set ENVIRONMENT variable. Default: none
#
+# [*template*]
+# Which ERB template to use. Default: python/gunicorn.erb
+#
# === Examples
#
# python::gunicorn { 'vhost':
@@ -34,11 +37,14 @@
# dir => '/var/www/project1/current',
# bind => 'unix:/tmp/gunicorn.socket',
# environment => 'prod',
+# template => 'python/gunicorn.erb',
# }
#
# === Authors
#
# Sergey Stankevich
+# Ashley Penney
+# Marc Fournier
#
define python::gunicorn (
$ensure = present,
@@ -46,8 +52,8 @@ define python::gunicorn (
$mode = 'wsgi',
$dir = false,
$bind = false,
- $app_interface = 'wsgi',
$environment = false,
+ $template = 'python/gunicorn.erb',
) {
# Parameter validation
@@ -60,7 +66,7 @@ define python::gunicorn (
mode => '0644',
owner => 'root',
group => 'root',
- content => template('python/gunicorn.erb'),
+ content => template($template),
}
}
diff --git a/manifests/requirements.pp b/manifests/requirements.pp
index b6c9b34..4dd1f1f 100644
--- a/manifests/requirements.pp
+++ b/manifests/requirements.pp
@@ -20,6 +20,7 @@
# === Authors
#
# Sergey Stankevich
+# Ashley Penney
#
define python::requirements (
$virtualenv = 'system',
@@ -38,7 +39,6 @@ define python::requirements (
default => "--proxy=${proxy}",
}
- $req_dir = inline_template('<%= requirements.match(%r!(.+)/.+!)[1] %>')
$req_crc = "${requirements}.sha1"
file { $requirements:
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,
}
diff --git a/tests/gunicorn.pp b/tests/gunicorn.pp
index c081fd6..c32ea1a 100644
--- a/tests/gunicorn.pp
+++ b/tests/gunicorn.pp
@@ -11,4 +11,5 @@ python::gunicorn { 'vhost':
dir => '/var/www/project1/current',
bind => 'unix:/tmp/gunicorn.socket',
environment => 'prod',
+ template => 'python/gunicorn.erb',
}
diff --git a/tests/virtualenv.pp b/tests/virtualenv.pp
index 190492c..da5ab57 100644
--- a/tests/virtualenv.pp
+++ b/tests/virtualenv.pp
@@ -9,4 +9,5 @@ python::virtualenv { '/var/www/project1':
version => 'system',
requirements => '/var/www/project1/requirements.txt',
proxy => 'http://proxy.domain.com:3128',
+ systempkgs => true,
}