summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Stankevich <stankevich@users.noreply.github.com>2013-11-08 03:26:59 -0800
committerSergey Stankevich <stankevich@users.noreply.github.com>2013-11-08 03:26:59 -0800
commit6372243d61025844e3aff4bff4591b1ea23449f5 (patch)
treef80b224fabd1fe8e79972ab0a633af5277688250
parente47c5bbc602cdc7d0e2c1fffe890517dd190999c (diff)
parent2d0f8216ab222a533d05d31331267b180c3aac47 (diff)
Merge pull request #37 from natgeo/master
Added cwd & timeout params to virtualenv
-rw-r--r--README.md6
-rw-r--r--manifests/virtualenv.pp13
2 files changed, 17 insertions, 2 deletions
diff --git a/README.md b/README.md
index e9a2b85..0bcd952 100644
--- a/README.md
+++ b/README.md
@@ -117,6 +117,10 @@ Creates Python virtualenv.
**index** - Base URL of Python package index. Default: none
+**cwd** - The directory from which to run the "pip install" command. Default: undef
+
+**timeout** - The maximum time in seconds the "pip install" command should take. Default: 1800
+
python::virtualenv { '/var/www/project1':
ensure => present,
version => 'system',
@@ -126,6 +130,8 @@ Creates Python virtualenv.
distribute => false,
owner => 'appuser',
group => 'apps',
+ cwd => '/var/www/project1',
+ timeout => 0,
}
### python::gunicorn
diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp
index bdcfc6f..8486183 100644
--- a/manifests/virtualenv.pp
+++ b/manifests/virtualenv.pp
@@ -37,6 +37,12 @@
# [*path*]
# Specifies the PATH variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ]
#
+# [*cwd*]
+# The directory from which to run the "pip install" command. Default: undef
+#
+# [*timeout*]
+# The maximum time in seconds the "pip install" command should take. Default: 1800
+#
# === Examples
#
# python::virtualenv { '/var/www/project1':
@@ -66,7 +72,9 @@ define python::virtualenv (
$group = 'root',
$proxy = false,
$environment = [],
- $path = [ '/bin', '/usr/bin', '/usr/sbin' ]
+ $path = [ '/bin', '/usr/bin', '/usr/sbin' ],
+ $cwd = undef,
+ $timeout = 1800
) {
$venv_dir = $name
@@ -115,10 +123,11 @@ define python::virtualenv (
exec { "python_requirements_initial_install_${requirements}_${venv_dir}":
command => "${venv_dir}/bin/pip --log-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} -r ${requirements}",
refreshonly => true,
- timeout => 1800,
+ timeout => $timeout,
user => $owner,
subscribe => Exec["python_virtualenv_${venv_dir}"],
environment => $environment,
+ cwd => $cwd
}
python::requirements { "${requirements}_${venv_dir}":