summaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorTails developers <tails@boum.org>2012-10-23 15:03:54 +0200
committerintrigeri <intrigeri@boum.org>2012-10-25 14:20:33 +0200
commit4ed9def99c99a6d5c21af18eb0b73a1d6081cbee (patch)
tree4d8c5c838c7c17cdd08a2ab8c3c58a6d34b21845 /manifests
parentf8ec0b9d756dbe7fb360a3059231045e3d8acba5 (diff)
Convert the reprepro class to parametrized format
We remove the deprecated dynamic lookup for variables and now have them as class parameters. The reprepro::cron and reprepro::inoticoming classes have been integrated in the reprepro class as two boolean arguments. As these are not mutually exclusive, it is cleaner that way. We add a test manifest for the reprepro class along the way.
Diffstat (limited to 'manifests')
-rw-r--r--manifests/cron.pp8
-rw-r--r--manifests/init.pp99
-rw-r--r--manifests/inotify.pp31
3 files changed, 66 insertions, 72 deletions
diff --git a/manifests/cron.pp b/manifests/cron.pp
deleted file mode 100644
index 1fae59e..0000000
--- a/manifests/cron.pp
+++ /dev/null
@@ -1,8 +0,0 @@
-class reprepro::cron inherits reprepro {
- cron { reprepro:
- command => "/usr/bin/reprepro --silent -b $basedir processincoming incoming",
- user => reprepro,
- minute => '*/5',
- require => [ Package['reprepro'], File["$basedir/conf/distributions"] ]
- }
-}
diff --git a/manifests/init.pp b/manifests/init.pp
index 77a014d..ebf8a91 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -1,38 +1,20 @@
-class reprepro {
-
- case $reprepro_manage_distributions_conf {
- '': { $reprepro_manage_distributions_conf = true }
- }
-
- case $reprepro_manage_incoming_conf {
- '': { $reprepro_manage_incoming_conf = true }
- }
-
- case $reprepro_origin {
- '': { $reprepro_origin = $domain }
- }
-
- case $reprepro_uploaders {
- '': { fail("You need the repository uploaders! Please set \$reprepro_uploaders in your config") }
- }
-
- $basedir = $reprepro_basedir ? {
- '' => '/srv/reprepro',
- default => $reprepro_basedir,
- }
-
+class reprepro (
+ $uploaders = 'undefined',
+ $basedir = '/srv/reprepro',
+ $origin = $::domain,
+ $basedir_mode = '0771',
+ $incoming_mode = '1777',
+ $manage_distributions_conf = true,
+ $manage_incoming_conf = true,
+ $handle_incoming_with_cron = false,
+ $handle_incoming_with_inotify = false,
+){
package {
"reprepro": ensure => 'installed';
}
- $basedir_mode = $reprepro_basedir_mode ? {
- '' => 0771,
- default => $reprepro_basedir_mode,
- }
-
- $incoming_mode = $reprepro_incoming_mode ? {
- '' => 1777,
- default => $reprepro_incoming_mode,
+ if $uploaders == 'undefined' {
+ fail("The uploaders parameter is required by the reprepro class.")
}
user { "reprepro":
@@ -113,7 +95,7 @@ class reprepro {
mode => 755,
}
- if $reprepro_manage_distributions_conf {
+ if $manage_distributions_conf {
File["$basedir/conf/distributions"] {
owner => root,
group => reprepro,
@@ -135,7 +117,7 @@ class reprepro {
}
}
- if $reprepro_manage_incoming_conf {
+ if $manage_incoming_conf {
File["$basedir/conf/incoming"] {
mode => 0664,
owner => root,
@@ -144,6 +126,57 @@ class reprepro {
}
}
+ # Handling of incoming with cron
+
+ $cron_presence = $handle_incoming_with_cron ? {
+ true => present,
+ default => absent,
+ }
+
+ cron { 'reprepro':
+ ensure => $cron_presence,
+ command => "/usr/bin/reprepro --silent -b $basedir processincoming incoming",
+ user => reprepro,
+ minute => '*/5',
+ require => [ Package['reprepro'], File["$basedir/conf/distributions"] ],
+ }
+
+ # Handling of incoming with inoticoming
+
+ $inoticoming_presence = $handle_incoming_with_inotify ? {
+ true => present,
+ default => absent,
+ }
+ $inoticoming_enabled = $handle_incoming_with_inotify ? {
+ true => true,
+ default => false,
+ }
+
+ package { 'inoticoming':
+ ensure => $inoticoming_presence,
+ }
+ file { '/etc/init.d/reprepro':
+ ensure => $inoticoming_presence,
+ owner => root,
+ group => root,
+ mode => 0755,
+ source => "puppet://${server}/modules/reprepro/inoticoming.init",
+ }
+ file { '/etc/default/reprepro':
+ ensure => $inoticoming_presence,
+ owner => root, group => root, mode => 0755,
+ content => template('reprepro/inoticoming.default.erb'),
+ }
+
+ service { 'reprepro':
+ ensure => $inoticoming_enabled,
+ enable => $inoticoming_enabled,
+ pattern => 'inoticoming.*reprepro.*processincoming',
+ hasstatus => false,
+ require => [ Package['inoticoming'],
+ File['/etc/default/reprepro'],
+ File['/etc/init.d/reprepro'] ],
+ }
exec {
"/usr/local/bin/reprepro-export-key":
diff --git a/manifests/inotify.pp b/manifests/inotify.pp
deleted file mode 100644
index 45fcb7e..0000000
--- a/manifests/inotify.pp
+++ /dev/null
@@ -1,31 +0,0 @@
-class reprepro::inotify inherits reprepro {
- case $lsbdistcodename {
- etch: {
- package {
- "inoticoming": ensure => '0.2.0-1~bpo40+1';
- }
- }
- default: {
- package {
- "inoticoming": ensure => 'installed';
- }
- }
- }
- file { "/etc/init.d/reprepro":
- owner => root, group => root, mode => 0755,
- source => "puppet://$server/modules/reprepro/inoticoming.init";
- }
- file { "/etc/default/reprepro":
- ensure => present,
- owner => root, group => root, mode => 0755,
- content => template('reprepro/inoticoming.default.erb'),
- }
-
- service { "reprepro":
- ensure => "running",
- pattern => "inoticoming.*reprepro.*processincoming",
- hasstatus => false,
- require => [File["/etc/default/reprepro"],
- File["/etc/init.d/reprepro"] ],
- }
-}