summaryrefslogtreecommitdiff
path: root/manifests/requirements.pp
diff options
context:
space:
mode:
authorSergey Stankevich <sergey@stankevi.ch>2013-06-12 11:41:30 -0700
committerSergey Stankevich <sergey@stankevi.ch>2013-06-12 11:41:30 -0700
commit5d26f95cd38676bfd8191e3c150db488429ae099 (patch)
tree1af4bec30a71cc260eb0cf96052b00602ef02ada /manifests/requirements.pp
parent9aae0a0b63657a81225a2a670c9a9c89bbed2ff4 (diff)
parent07e6cc6b3d2afa25be0ae829c5bff8385c2815f3 (diff)
Merge pull request #20 from fgimian/master
Stability & performance improvements along with a few new features (take what you wish)
Diffstat (limited to 'manifests/requirements.pp')
-rw-r--r--manifests/requirements.pp27
1 files changed, 21 insertions, 6 deletions
diff --git a/manifests/requirements.pp b/manifests/requirements.pp
index 8b94839..67906fc 100644
--- a/manifests/requirements.pp
+++ b/manifests/requirements.pp
@@ -10,9 +10,18 @@
# [*virtualenv*]
# virtualenv to run pip in. Default: system-wide
#
+# [*owner*]
+# The owner of the virtualenv being manipulated. Default: root
+#
+# [*group*]
+# The group relating to the virtualenv being manipulated. Default: root
+#
# [*proxy*]
# Proxy server to use for outbound connections. Default: none
#
+# [*environment*]
+# Additional environment variables required to install the packages. Default: none
+#
# === Examples
#
# python::requirements { '/var/www/project1/requirements.txt':
@@ -24,22 +33,28 @@
#
# Sergey Stankevich
# Ashley Penney
+# Fotis Gimian
#
define python::requirements (
$requirements = $name,
$virtualenv = 'system',
- $proxy = false,
$owner = 'root',
- $group = 'root'
+ $group = 'root',
+ $proxy = false,
+ $environment = []
) {
+ if $virtualenv == 'system' and ($owner != 'root' or $group != 'root') {
+ fail('python::pip: root user must be used when virtualenv is system')
+ }
+
$cwd = $virtualenv ? {
'system' => '/',
- default => "${virtualenv}/bin/",
+ default => "${virtualenv}",
}
$pip_env = $virtualenv ? {
- 'system' => '`which pip`',
+ 'system' => 'pip',
default => "${virtualenv}/bin/pip",
}
@@ -64,12 +79,12 @@ define python::requirements (
exec { "python_requirements${name}":
provider => shell,
- command => "${pip_env} install ${proxy_flag} -r ${requirements}",
- cwd => $cwd,
+ command => "${pip_env} --log-file ${cwd}/pip.log install ${proxy_flag} -r ${requirements}",
refreshonly => true,
timeout => 1800,
user => $owner,
subscribe => File[$requirements],
+ environment => $environment,
}
}