summaryrefslogtreecommitdiff
path: root/manifests/requirements.pp
diff options
context:
space:
mode:
authorNick Groenen <zoni@zoni.nl>2013-03-11 15:14:08 +0100
committerNick Groenen <zoni@zoni.nl>2013-03-11 15:18:24 +0100
commit88c178043145581d38c8040baec67051ee5c937a (patch)
tree47d35bd9e4761267766d6bbc3938f5281f292464 /manifests/requirements.pp
parent451b21537565b335a45bca0d90ff03567a10e9c2 (diff)
Allow virtualenv definitions to share the same requirements file
Diffstat (limited to 'manifests/requirements.pp')
-rw-r--r--manifests/requirements.pp28
1 files changed, 17 insertions, 11 deletions
diff --git a/manifests/requirements.pp b/manifests/requirements.pp
index 4dd1f1f..22988e5 100644
--- a/manifests/requirements.pp
+++ b/manifests/requirements.pp
@@ -4,6 +4,9 @@
#
# === Parameters
#
+# [*requirements*]
+# Path to the requirements file. Defaults to the resource name
+#
# [*virtualenv*]
# virtualenv to run pip in. Default: system-wide
#
@@ -23,12 +26,11 @@
# Ashley Penney
#
define python::requirements (
- $virtualenv = 'system',
- $proxy = false
+ $requirements = $name,
+ $virtualenv = 'system',
+ $proxy = false
) {
- $requirements = $name
-
$pip_env = $virtualenv ? {
'system' => '`which pip`',
default => "${virtualenv}/bin/pip",
@@ -41,13 +43,17 @@ define python::requirements (
$req_crc = "${requirements}.sha1"
- file { $requirements:
- ensure => present,
- mode => '0644',
- owner => 'root',
- group => 'root',
- replace => false,
- content => '# Puppet will install and/or update pip packages listed here',
+ # This will ensure multiple python::virtualenv definitions can share the
+ # the same requirements file.
+ if !defined(File[$requirements]) {
+ file { $requirements:
+ ensure => present,
+ mode => '0644',
+ owner => 'root',
+ group => 'root',
+ replace => false,
+ content => '# Puppet will install and/or update pip packages listed here',
+ }
}
# SHA1 checksum to detect changes