diff options
author | Micah Anderson <micah@riseup.net> | 2011-08-30 15:31:50 -0400 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2011-08-30 15:31:50 -0400 |
commit | d28e4e238a5f738f265f585f69ff3221de3118ab (patch) | |
tree | 5c004d5e60c1e245f8941feb8fc3e6c56dc9839d | |
parent | 9ebb2fe7183953c97e90983e41fe3fb875d41e0d (diff) |
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 :)
-rw-r--r-- | manifests/expire.pp | 20 |
1 files 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 } |