From bf6dd071100eb4283532b59cec5288ed2d3b055b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Mon, 7 Jan 2013 17:58:06 -0500 Subject: move parametrized class elements into a define to support multiple repositories --- manifests/init.pp | 59 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index e96cf2d..fa48663 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,15 +1,4 @@ -class reprepro ( - $uploaders, - $basedir = '/srv/reprepro', - $origin = $::domain, - $architectures = [ 'amd64', 'i386', 'source' ], - $basedir_mode = '0771', - $incoming_mode = '1777', - $manage_distributions_conf = true, - $manage_incoming_conf = true, - $handle_incoming_with_cron = false, - $handle_incoming_with_inotify = false -){ +class reprepro { package { "reprepro": ensure => 'installed'; } @@ -29,6 +18,35 @@ class reprepro ( } } + file { '/usr/local/bin/reprepro-export-key': + ensure => present, + source => "puppet:///modules/reprepro/reprepro-export-key.sh", + owner => root, + group => root, + mode => '0755', + } +} + +class reprepro::inotify { + package { 'inoticoming': + ensure => 'present', + } +} + +define reprepro::repository ( + $uploaders, + $basedir = '/srv/reprepro', + $origin = $::domain, + $architectures = [ 'amd64', 'i386', 'source' ], + $basedir_mode = '0771', + $incoming_mode = '1777', + $manage_distributions_conf = true, + $manage_incoming_conf = true, + $handle_incoming_with_cron = false, + $handle_incoming_with_inotify = false +) { + include reprepro + File { owner => reprepro, group => reprepro, @@ -83,14 +101,8 @@ class reprepro ( ensure => present, mode => '0600', } - file { '/usr/local/bin/reprepro-export-key': - ensure => present, - content => template('reprepro/reprepro-export-key.sh.erb'), - owner => root, - group => root, - mode => '0755', - } - exec { "/usr/local/bin/reprepro-export-key": + + exec { "/usr/local/bin/reprepro-export-key '$basedir'": creates => "$basedir/key.asc", user => reprepro, subscribe => File["$basedir/.gnupg/secring.gpg"], @@ -140,7 +152,7 @@ class reprepro ( default => absent, } - cron { 'reprepro': + cron { "reprepro-$name": ensure => $cron_presence, command => "/usr/bin/reprepro --silent -b $basedir processincoming incoming", user => reprepro, @@ -160,9 +172,10 @@ class reprepro ( default => false, } - package { 'inoticoming': - ensure => $inoticoming_presence, + if $handle_incoming_with_inotify { + include reprepro::inotify } + file { '/etc/init.d/reprepro': ensure => $inoticoming_presence, owner => root, -- cgit v1.2.3