summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Beaupré <anarcat@koumbit.org>2013-01-07 18:04:27 -0500
committerAntoine Beaupré <anarcat@koumbit.org>2013-01-07 18:52:25 -0500
commit3e9b70157c4b1ce00cd3ace6eeba682bbc4eaf73 (patch)
tree127735b1af9972c7f732b97a2d4aadc693fa0fa3
parentee04b392d9e33958b899aff1e2f9faf3620fccba (diff)
make the user/group customizable per repository
-rw-r--r--manifests/init.pp15
-rw-r--r--manifests/repository.pp31
2 files changed, 25 insertions, 21 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 21a1836..16aa700 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -3,21 +3,6 @@ class reprepro {
"reprepro": ensure => 'installed';
}
- user { "reprepro":
- ensure => "present",
- home => "$basedir",
- gid => "reprepro",
- password => "*",
- comment => "reprepro sandbox",
- require => Group["reprepro"],
- }
-
- if !defined(Group["reprepro"]) {
- group { "reprepro":
- ensure => present,
- }
- }
-
file { '/usr/local/bin/reprepro-export-key':
ensure => present,
source => "puppet:///modules/reprepro/reprepro-export-key.sh",
diff --git a/manifests/repository.pp b/manifests/repository.pp
index 431093d..20f6711 100644
--- a/manifests/repository.pp
+++ b/manifests/repository.pp
@@ -1,5 +1,7 @@
define reprepro::repository (
$uploaders,
+ $user = 'reprepro',
+ $group = 'reprepro',
$basedir = '/srv/reprepro',
$origin = $::domain,
$architectures = [ 'amd64', 'i386', 'source' ],
@@ -12,9 +14,26 @@ define reprepro::repository (
) {
include reprepro
+ if !defined(User[$user]) {
+ user { $user:
+ ensure => "present",
+ home => "$basedir",
+ gid => $group,
+ password => "*",
+ comment => "reprepro sandbox",
+ require => Group[$group],
+ }
+ }
+
+ if !defined(Group[$group]) {
+ group { $group:
+ ensure => present,
+ }
+ }
+
File {
- owner => reprepro,
- group => reprepro,
+ owner => $user,
+ group => $group,
}
file { "$basedir":
@@ -69,7 +88,7 @@ define reprepro::repository (
exec { "/usr/local/bin/reprepro-export-key '$basedir'":
creates => "$basedir/key.asc",
- user => reprepro,
+ user => $user,
subscribe => File["$basedir/.gnupg/secring.gpg"],
require => File["/usr/local/bin/reprepro-export-key"],
}
@@ -88,12 +107,12 @@ define reprepro::repository (
exec { "reprepro -b $basedir createsymlinks":
refreshonly => true,
subscribe => File["$basedir/conf/distributions"],
- user => reprepro,
+ user => $user,
path => "/usr/bin:/bin",
}
exec { "reprepro -b $basedir export":
refreshonly => true,
- user => reprepro,
+ user => $user,
subscribe => File["$basedir/conf/distributions"],
path => "/usr/bin:/bin",
}
@@ -120,7 +139,7 @@ define reprepro::repository (
cron { "reprepro-$name":
ensure => $cron_presence,
command => "/usr/bin/reprepro --silent -b $basedir processincoming incoming",
- user => reprepro,
+ user => $user,
minute => '*/5',
require => [ Package['reprepro'], File["$basedir/conf/distributions"],
File["$basedir/incoming"], ],