summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorSergey Stankevich <sergey@stankevi.ch>2013-05-06 06:08:12 -0700
committerSergey Stankevich <sergey@stankevi.ch>2013-05-06 06:08:12 -0700
commit2f91e3286888d147ab5fc1aca1e5a57b0b9f52f3 (patch)
tree442bccfa885c7af24dfc62ffadcc9670b3091c9a /manifests
parentc1a73e2a57b9177ce8781cb6eb846505e0af8bed (diff)
parentee2a67ad8596fa68cb3952e9ee659546f6cbd66d (diff)
Merge pull request #11 from theospears/virtualenv_owner
Allow setting owner for virtualenv and requirements
Diffstat (limited to 'manifests')
-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}"],
}
}