From e2d4e6ca10904e73a70e7398e830ccff5f4f29d6 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 5 Jun 2012 20:13:22 -0300 Subject: new style for 2.7 --- manifests/base.pp | 8 ++++---- manifests/centos.pp | 6 +++--- manifests/expire.pp | 33 ++++++++++++++++----------------- manifests/init.pp | 6 +++--- manifests/managesieve.pp | 2 +- manifests/quota.pp | 2 +- manifests/sieve.pp | 6 +++--- manifests/sql.pp | 8 ++++---- 8 files changed, 35 insertions(+), 36 deletions(-) diff --git a/manifests/base.pp b/manifests/base.pp index 85024ce..19cafbf 100644 --- a/manifests/base.pp +++ b/manifests/base.pp @@ -4,10 +4,10 @@ class dovecot::base { } file{'/etc/dovecot.conf': - source => [ "puppet:///modules/site-dovecot/config/${fqdn}/dovecot.conf", - "puppet:///modules/site-dovecot/config/${dovecot::type}/dovecot.conf", - "puppet:///modules/site-dovecot/config/dovecot.conf", - "puppet:///modules/dovecot/config/${operatingsystem}/dovecot.conf", + source => [ "puppet:///modules/site_dovecot/config/${::fqdn}/dovecot.conf", + "puppet:///modules/site_dovecot/config/${dovecot::type}/dovecot.conf", + "puppet:///modules/site_dovecot/config/dovecot.conf", + "puppet:///modules/dovecot/config/${::operatingsystem}/dovecot.conf", "puppet:///modules/dovecot/config/dovecot.conf" ], require => Package['dovecot'], notify => Service['dovecot'], diff --git a/manifests/centos.pp b/manifests/centos.pp index 8d6e067..7e7eefa 100644 --- a/manifests/centos.pp +++ b/manifests/centos.pp @@ -1,8 +1,8 @@ class dovecot::centos inherits dovecot::base { file{'/etc/sysconfig/dovecot': - source => [ "puppet:///modules/site-dovecot/sysconfig/${fqdn}/dovecot", - "puppet:///modules/site-dovecot/sysconfig/${dovecot::type}/dovecot", - "puppet:///modules/site-dovecot/sysconfig/dovecot", + source => [ "puppet:///modules/site_dovecot/sysconfig/${::fqdn}/dovecot", + "puppet:///modules/site_dovecot/sysconfig/${dovecot::type}/dovecot", + "puppet:///modules/site_dovecot/sysconfig/dovecot", "puppet:///modules/dovecot/sysconfig/dovecot" ], require => Package['dovecot'], notify => Service['dovecot'], diff --git a/manifests/expire.pp b/manifests/expire.pp index 2c9bc17..de8f086 100644 --- a/manifests/expire.pp +++ b/manifests/expire.pp @@ -1,21 +1,20 @@ -class dovecot::expire { +class dovecot::expire( + $type = 'script', + $mail_location = 'absent', + $expire_days = '14', + $directories = 'Trash\|Junk' +) { include ::dovecot file{'/etc/cron.daily/dovecot-expire': owner => root, group => 0, mode => 0755; } - if $dovecot_expire_type == 'legacy' or $dovecot_expire_type == 'mixed' { - case $dovecot_mail_location { - '': { fail("Need to set \$dovecot_mail_location on $fqdn!") } - } - case $dovecot_expire_dirs { - '': { $dovecot_expire_dirs = 'Trash\|Junk' } - } - case $dovecot_expire_days { - '': { $dovecot_expire_days = '14' } + if $dovecot::expire::type == 'legacy' or $dovecot::expire::type == 'mixed' { + case $dovecot::expire::mail_location { + 'absent': { fail("Need to set \$mail_location on ${::fqdn}!") } } File['/etc/cron.daily/dovecot-expire']{ - content => "find ${dovecot_mail_location} -regex '.*/\\.\\(${dovecot_expire_dirs}\\)\\(/.*\\)?\\/\\(cur\\|new\\)/.*' -type f -ctime +${dovecot_expire_days} -delete\n" + content => "find ${dovecot::expire::mail_location} -regex '.*/\\.\\(${dovecot::expire::directories}\\)\\(/.*\\)?\\/\\(cur\\|new\\)/.*' -type f -ctime +${dovecot::expire::days} -delete\n" } } else { File['/etc/cron.daily/dovecot-expire']{ @@ -23,11 +22,11 @@ class dovecot::expire { } } - if $dovecot_expire_type != 'legacy' { + if $dovecot::expire::type != 'legacy' { file{'/etc/dovecot-expire.conf': - source => [ "puppet:///modules/site-dovecot/expire/${fqdn}/dovecot-expire.conf", - "puppet:///modules/site-dovecot/expire/dovecot-expire.conf", - "puppet:///modules/dovecot/expire/${operatingsystem}/dovecot-expire.conf", + source => [ "puppet:///modules/site_dovecot/expire/${::fqdn}/dovecot-expire.conf", + "puppet:///modules/site_dovecot/expire/dovecot-expire.conf", + "puppet:///modules/dovecot/expire/${::operatingsystem}/dovecot-expire.conf", "puppet:///modules/dovecot/expire/dovecot-expire.conf" ], require => Package['dovecot'], notify => Service['dovecot'], @@ -40,8 +39,8 @@ class dovecot::expire { } } - case $dovecot_expire_type { - 'legacy': { info("no need to include anything for legacy mode") } + case $dovecot::expire::type { + 'legacy': { info("no need to include anything for legacy type") } 'mixed': { include ::dovecot::expire::sqlite } default: { include ::dovecot::expire::sqlite } } diff --git a/manifests/init.pp b/manifests/init.pp index a6f5fcc..adf2430 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,13 +5,13 @@ class dovecot( $pgsql = false, $mysql = false, $nagios_checks = { - 'imap-hostname' => $fqdn, - 'pop3-hostname' => $fqdn, + 'imap-hostname' => $::fqdn, + 'pop3-hostname' => $::fqdn, }, $munin_checks = true, $manage_shorewall = true ){ - case $operatingsystem { + case $::operatingsystem { centos: { include dovecot::centos } default: { include dovecot::base } } diff --git a/manifests/managesieve.pp b/manifests/managesieve.pp index 0343ed7..efe4435 100644 --- a/manifests/managesieve.pp +++ b/manifests/managesieve.pp @@ -2,7 +2,7 @@ class dovecot::managesieve( $type = 'some_unknown_type', $manage_shorewall = true, $nagios_checks = { - 'sieve-hostname' => $fqdn, + 'sieve-hostname' => $::fqdn, } ) { package{'dovecot-managesieve': diff --git a/manifests/quota.pp b/manifests/quota.pp index 78fb407..a4a3255 100644 --- a/manifests/quota.pp +++ b/manifests/quota.pp @@ -1,6 +1,6 @@ class dovecot::quota { file{'/usr/libexec/dovecot/quota-warning.sh': - source => [ "puppet:///modules/site-dovecot/quota/quota-warning.sh", + source => [ "puppet:///modules/site_dovecot/quota/quota-warning.sh", "puppet:///modules/dovecot/quota/quota-warning.sh" ], require => Package['dovecot'], before => Service['dovecot'], diff --git a/manifests/sieve.pp b/manifests/sieve.pp index 60a6cd9..c0aa54c 100644 --- a/manifests/sieve.pp +++ b/manifests/sieve.pp @@ -18,9 +18,9 @@ class dovecot::sieve { owner => root, group => root, mode => 0644; } file{'/var/lib/dovecot-sieve/default.sieve': - source => [ "puppet:///modules/site-dovecot/sieve/${fqdn}/default.sieve", - "puppet:///modules/site-dovecot/sieve/default.sieve", - "puppet:///modules/dovecot/sieve/${operatingsystem}/default.sieve", + source => [ "puppet:///modules/site_dovecot/sieve/${::fqdn}/default.sieve", + "puppet:///modules/site_dovecot/sieve/default.sieve", + "puppet:///modules/dovecot/sieve/${::operatingsystem}/default.sieve", "puppet:///modules/dovecot/sieve/default.sieve" ], notify => Exec['compile_default_sieve'], owner => root, group => root, mode => 0644; diff --git a/manifests/sql.pp b/manifests/sql.pp index b9c9248..0db154b 100644 --- a/manifests/sql.pp +++ b/manifests/sql.pp @@ -1,9 +1,9 @@ class dovecot::sql { file{'/etc/dovecot-sql.conf': - source => [ "puppet:///modules/site-dovecot/sql/${fqdn}/dovecot-sql.conf", - "puppet:///modules/site-dovecot/sql/${dovecot::type}/dovecot-sql.conf", - "puppet:///modules/site-dovecot/sql/dovecot-sql.conf", - "puppet:///modules/site/sql/${operatingsystem}/dovecot-sql.conf", + source => [ "puppet:///modules/site_dovecot/sql/${::fqdn}/dovecot-sql.conf", + "puppet:///modules/site_dovecot/sql/${dovecot::type}/dovecot-sql.conf", + "puppet:///modules/site_dovecot/sql/dovecot-sql.conf", + "puppet:///modules/site/sql/${::operatingsystem}/dovecot-sql.conf", "puppet:///modules/site/sql/dovecot-sql.conf" ], require => Package['dovecot'], notify => Service['dovecot'], -- cgit v1.2.3