summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Stankevich <stankevich@users.noreply.github.com>2014-07-18 16:31:17 -0400
committerSergey Stankevich <stankevich@users.noreply.github.com>2014-07-18 16:31:17 -0400
commitf01567c877e574264bd9b8816f640203b0e563b0 (patch)
treeca3e599276e4a0d89f41863cb4618502e32d15ad
parent55bad98e18d5f696db68b9a2a64c3c0a2efbc263 (diff)
parent2865f4fb87ea7e5831ed497ddb90999f83913b7e (diff)
Merge pull request #93 from wimh/master
allow to specify directory from which to run the "pip install" command
-rw-r--r--manifests/requirements.pp9
-rw-r--r--manifests/virtualenv.pp1
2 files changed, 8 insertions, 2 deletions
diff --git a/manifests/requirements.pp b/manifests/requirements.pp
index 11c5f00..2373337 100644
--- a/manifests/requirements.pp
+++ b/manifests/requirements.pp
@@ -32,6 +32,9 @@
# requirements file - Useful for when the requirements file is written as part of a
# resource other than file (E.g vcsrepo)
#
+# [*cwd*]
+# The directory from which to run the "pip install" command. Default: undef
+#
# === Examples
#
# python::requirements { '/var/www/project1/requirements.txt':
@@ -54,13 +57,14 @@ define python::requirements (
$src = false,
$environment = [],
$forceupdate = false,
+ $cwd = undef,
) {
if $virtualenv == 'system' and ($owner != 'root' or $group != 'root') {
fail('python::pip: root user must be used when virtualenv is system')
}
- $cwd = $virtualenv ? {
+ $rootdir = $virtualenv ? {
'system' => '/',
default => $virtualenv,
}
@@ -96,9 +100,10 @@ define python::requirements (
exec { "python_requirements${name}":
provider => shell,
- command => "${pip_env} --log ${cwd}/pip.log install ${proxy_flag} ${src_flag} -r ${requirements}",
+ command => "${pip_env} --log ${rootdir}/pip.log install ${proxy_flag} ${src_flag} -r ${requirements}",
refreshonly => !$forceupdate,
timeout => 1800,
+ cwd => $cwd,
user => $owner,
subscribe => File[$requirements],
environment => $environment,
diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp
index 419e2ae..769c5a8 100644
--- a/manifests/virtualenv.pp
+++ b/manifests/virtualenv.pp
@@ -154,6 +154,7 @@ define python::virtualenv (
proxy => $proxy,
owner => $owner,
group => $group,
+ cwd => $cwd,
require => Exec["python_virtualenv_${venv_dir}"],
}
}