summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/requirements.pp10
-rw-r--r--manifests/virtualenv.pp14
2 files changed, 21 insertions, 3 deletions
diff --git a/manifests/requirements.pp b/manifests/requirements.pp
index 0559632..3a32b0f 100644
--- a/manifests/requirements.pp
+++ b/manifests/requirements.pp
@@ -28,7 +28,9 @@
define python::requirements (
$requirements = $name,
$virtualenv = 'system',
- $proxy = false
+ $proxy = false,
+ $owner = 'root',
+ $group = 'root'
) {
$cwd = $virtualenv ? {
@@ -54,8 +56,8 @@ define python::requirements (
file { $requirements:
ensure => present,
mode => '0644',
- owner => 'root',
- group => 'root',
+ owner => $owner,
+ group => $group,
replace => false,
content => '# Puppet will install and/or update pip packages listed here',
}
@@ -65,6 +67,7 @@ define python::requirements (
exec { "python_requirements_check_${name}":
command => "sha1sum ${requirements} > ${req_crc}",
unless => "sha1sum -c ${req_crc}",
+ user => $owner,
require => File[$requirements],
}
@@ -74,6 +77,7 @@ define python::requirements (
cwd => $cwd,
refreshonly => true,
timeout => 1800,
+ user => $owner,
subscribe => Exec["python_requirements_check_${name}"],
}
diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp
index b9ab88e..ae0e847 100644
--- a/manifests/virtualenv.pp
+++ b/manifests/virtualenv.pp
@@ -45,6 +45,8 @@ define python::virtualenv (
$proxy = false,
$systempkgs = false,
$distribute = true,
+ $owner = 'root',
+ $group = 'root'
) {
$venv_dir = $name
@@ -81,15 +83,25 @@ define python::virtualenv (
${proxy_command} \
&& virtualenv -p `which ${python}` ${system_pkgs_flag} ${venv_dir} \
&& ${venv_dir}/bin/pip install ${proxy_flag} --upgrade ${distribute_pkg} pip",
+ user => $owner,
creates => $venv_dir,
path => [ '/bin', '/usr/bin', '/usr/sbin' ],
}
+ file{$venv_dir:
+ ensure => directory,
+ owner => $owner,
+ group => $group,
+ recurse => true,
+ require => Exec["python_virtualenv_${venv_dir}"],
+ }
+
if $requirements {
exec { "python_requirements_initial_install_${requirements}_${venv_dir}":
command => "${venv_dir}/bin/pip install ${proxy_flag} --requirement ${requirements}",
refreshonly => true,
timeout => 1800,
+ user => $owner,
subscribe => Exec["python_virtualenv_${venv_dir}"],
}
@@ -97,6 +109,8 @@ define python::virtualenv (
requirements => $requirements,
virtualenv => $venv_dir,
proxy => $proxy,
+ owner => $owner,
+ group => $group,
require => Exec["python_virtualenv_${venv_dir}"],
}
}