From d28e4e238a5f738f265f585f69ff3221de3118ab Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 30 Aug 2011 15:31:50 -0400 Subject: switch class expire to a parameterized class NOTE: if you are using this class, you will need to change some variables old: $dovecot_expire_type new: $type old: $dovecot_mail_location new: $mail_location old: $dovecot_expire_dirs new: $dirs old: $dovecot_expire_days new: $days much simplier :) --- manifests/expire.pp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/manifests/expire.pp b/manifests/expire.pp index f87318f..53e69e6 100644 --- a/manifests/expire.pp +++ b/manifests/expire.pp @@ -1,22 +1,22 @@ -class dovecot::expire { +class dovecot::expire ( $type = 'sqlite', $mail_location = '' $dirs = '', $days = '' ) { 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 { + if $type == 'legacy' or $type == 'mixed' { + case $mail_location { '': { fail("Need to set \$dovecot_mail_location on $fqdn!") } } - case $dovecot_expire_dirs { - '': { $dovecot_expire_dirs = 'Trash\|Junk' } + case $dirs { + '': { $dirs = 'Trash\|Junk' } } - case $dovecot_expire_days { - '': { $dovecot_expire_days = '14' } + case $days { + '': { $days = '14' } } 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 ${mail_location} -regex '.*/\\.\\(${dirs}\\)\\(/.*\\)?\\/\\(cur\\|new\\)/.*' -type f -ctime +${days} -delete\n" } } else { case $operatingsystem { @@ -34,7 +34,7 @@ class dovecot::expire { } } - if $dovecot_expire_type != 'legacy' { + if $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", @@ -51,7 +51,7 @@ class dovecot::expire { } } - case $dovecot_expire_type { + case $type { 'legacy': { info("no need to include anything for legacy mode") } 'mixed': { include ::dovecot::expire::sqlite } 'mysql': { include ::dovecot::expire::mysql } -- cgit v1.2.3