summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2010-07-01 06:02:49 +0200
committermh <mh@immerda.ch>2010-07-01 06:02:49 +0200
commitcfaa011edc190c18f709d7ebdb8c635ebef4bb34 (patch)
tree430ffd8d4ec03a67f8a96d25a91c3c3740fdd7ef
parentfed3977c8ba48888fa62b1adb1f015038a092b54 (diff)
introduce legacy way to expire mails in certain folders
-rw-r--r--manifests/expire.pp48
1 files changed, 35 insertions, 13 deletions
diff --git a/manifests/expire.pp b/manifests/expire.pp
index 61fc023..4381c07 100644
--- a/manifests/expire.pp
+++ b/manifests/expire.pp
@@ -1,26 +1,48 @@
class dovecot::expire {
include ::dovecot
- file{'/etc/dovecot-expire.conf':
- source => [ "puppet://$server/modules/site-dovecot/expire/${fqdn}/dovecot-expire.conf",
- "puppet://$server/modules/site-dovecot/expire/dovecot-expire.conf",
- "puppet://$server/modules/dovecot/expire/${operatingsystem}/dovecot-expire.conf",
- "puppet://$server/modules/dovecot/expire/dovecot-expire.conf" ],
- require => Package['dovecot'],
- notify => Service['dovecot'],
- owner => root, group => 0, mode => 0600;
- }
file{'/etc/cron.daily/dovecot-expire':
- content => "dovecot --exec-mail ext /usr/libexec/dovecot/expire-tool.sh\n",
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' }
+ }
+ File['/etc/cron.daily/dovecot-expire']{
+ content => "find ${dovecot_mail_location} -regex '.*/\.\(${dovecot_expire_dirs}\)\(/.*\)?\/\(cur\|new\)/.*' -type f -ctime +${dovecot_expire_days}\n"
+ }
+ } else {
+ File['/etc/cron.daily/dovecot-expire']{
+ content => "dovecot --exec-mail ext /usr/libexec/dovecot/expire-tool.sh\n"
+ }
+ }
+
+ if $dovecot_expire_type != 'legacy' {
+ file{'/etc/dovecot-expire.conf':
+ source => [ "puppet://$server/modules/site-dovecot/expire/${fqdn}/dovecot-expire.conf",
+ "puppet://$server/modules/site-dovecot/expire/dovecot-expire.conf",
+ "puppet://$server/modules/dovecot/expire/${operatingsystem}/dovecot-expire.conf",
+ "puppet://$server/modules/dovecot/expire/dovecot-expire.conf" ],
+ require => Package['dovecot'],
+ notify => Service['dovecot'],
+ owner => root, group => 0, mode => 0600;
+ }
- file{'/usr/libexec/dovecot/expire-tool.sh':
- source => "puppet://$server/modules/dovecot/expire/expire-tool.sh",
- owner => root, group => 0, mode => 0700;
+ file{'/usr/libexec/dovecot/expire-tool.sh':
+ source => "puppet://$server/modules/dovecot/expire/expire-tool.sh",
+ owner => root, group => 0, mode => 0700;
+ }
}
case $dovecot_expire_type {
+ 'legacy': { info("no need to include anything for legacy mode") }
+ 'mixed': { include ::dovecot::expire::sqlite }
default: { include ::dovecot::expire::sqlite }
}
}