From 8a39fe6efb7533cf5b31ca7af74a057610c2f4f1 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Thu, 25 Aug 2011 15:49:07 -0400 Subject: formatting standardization --- manifests/expire.pp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'manifests/expire.pp') diff --git a/manifests/expire.pp b/manifests/expire.pp index 2c9bc17..9d53bb4 100644 --- a/manifests/expire.pp +++ b/manifests/expire.pp @@ -1,7 +1,8 @@ class dovecot::expire { + include ::dovecot - file{'/etc/cron.daily/dovecot-expire': + file { '/etc/cron.daily/dovecot-expire': owner => root, group => 0, mode => 0755; } if $dovecot_expire_type == 'legacy' or $dovecot_expire_type == 'mixed' { @@ -34,7 +35,7 @@ class dovecot::expire { owner => root, group => 0, mode => 0600; } - file{'/usr/libexec/dovecot/expire-tool.sh': + file { '/usr/libexec/dovecot/expire-tool.sh': source => "puppet:///modules/dovecot/expire/expire-tool.sh", owner => root, group => 0, mode => 0700; } -- cgit v1.2.3 From 8ebe49c6d20bd2fd7d59303d193fe941742bb1e7 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 30 Aug 2011 15:12:40 -0400 Subject: add mysql expire capability, provides a mysql-dict-expire.conf --- manifests/expire.pp | 1 + 1 file changed, 1 insertion(+) (limited to 'manifests/expire.pp') diff --git a/manifests/expire.pp b/manifests/expire.pp index 9d53bb4..9bc120a 100644 --- a/manifests/expire.pp +++ b/manifests/expire.pp @@ -44,6 +44,7 @@ class dovecot::expire { case $dovecot_expire_type { 'legacy': { info("no need to include anything for legacy mode") } 'mixed': { include ::dovecot::expire::sqlite } + 'mysql': { include ::dovecot::expire::mysql } default: { include ::dovecot::expire::sqlite } } } -- cgit v1.2.3 From 9ebb2fe7183953c97e90983e41fe3fb875d41e0d Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 30 Aug 2011 15:13:08 -0400 Subject: add debian-specific cron expire snippet --- manifests/expire.pp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'manifests/expire.pp') diff --git a/manifests/expire.pp b/manifests/expire.pp index 9bc120a..f87318f 100644 --- a/manifests/expire.pp +++ b/manifests/expire.pp @@ -19,8 +19,18 @@ class dovecot::expire { content => "find ${dovecot_mail_location} -regex '.*/\\.\\(${dovecot_expire_dirs}\\)\\(/.*\\)?\\/\\(cur\\|new\\)/.*' -type f -ctime +${dovecot_expire_days} -delete\n" } } else { - File['/etc/cron.daily/dovecot-expire']{ - content => "dovecot --exec-mail ext /usr/libexec/dovecot/expire-tool.sh\n" + case $operatingsystem { + debian: { + augeas { "expire_cron": + context => "/files/etc/default/dovecot/rule", + changes => [ 'set /files/etc/default/dovecot/EXPIRE_CRON \'"daily"\'' ], + } + } + default: { + File['/etc/cron.daily/dovecot-expire']{ + content => "dovecot --exec-mail ext /usr/libexec/dovecot/expire-tool.sh\n" + } + } } } -- cgit v1.2.3 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(-) (limited to 'manifests/expire.pp') 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 From 82fd77f4431d1066dd3a281724b3466091a170f8 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 30 Aug 2011 15:35:00 -0400 Subject: fix missing comma --- manifests/expire.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/expire.pp') diff --git a/manifests/expire.pp b/manifests/expire.pp index 53e69e6..4a3bff5 100644 --- a/manifests/expire.pp +++ b/manifests/expire.pp @@ -1,4 +1,4 @@ -class dovecot::expire ( $type = 'sqlite', $mail_location = '' $dirs = '', $days = '' ) { +class dovecot::expire ( $type = 'sqlite', $mail_location = '', $dirs = '', $days = '' ) { include ::dovecot -- cgit v1.2.3 From f5c569c50b4251e0340a51cf59250bb36ef0a2d9 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 30 Aug 2011 15:56:56 -0400 Subject: the dovecot-expire.conf isn't used for the mysql type I do not understand what the dovecot-expire.conf is used for, the dovecot documentation on the expire plugin (http://wiki1.dovecot.org/Plugins/Expire) doesn't talk about that file, and I cannot locate it via searches (except to find this module!). There is also no example file in the files/expire hierarchy. If its supposed to be for the sqlite method, then it should just be moved into expire/sqlite.pp - but I am not sure how to proceed with this, because I do not understand what the 'mixed' type is supposed to be. --- manifests/expire.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/expire.pp') diff --git a/manifests/expire.pp b/manifests/expire.pp index 4a3bff5..72e1ad6 100644 --- a/manifests/expire.pp +++ b/manifests/expire.pp @@ -34,7 +34,7 @@ class dovecot::expire ( $type = 'sqlite', $mail_location = '', $dirs = '', $days } } - if $type != 'legacy' { + if $type != 'legacy' and $type != 'mysql' { file{'/etc/dovecot-expire.conf': source => [ "puppet:///modules/site-dovecot/expire/${fqdn}/dovecot-expire.conf", "puppet:///modules/site-dovecot/expire/dovecot-expire.conf", -- cgit v1.2.3 From 576cc1d3c30ceef2928c3bf581fdbb5530027553 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 2 Sep 2011 17:38:31 -0400 Subject: setup dovecot version differences for expire class --- manifests/expire.pp | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'manifests/expire.pp') diff --git a/manifests/expire.pp b/manifests/expire.pp index 72e1ad6..e5679f4 100644 --- a/manifests/expire.pp +++ b/manifests/expire.pp @@ -5,6 +5,7 @@ class dovecot::expire ( $type = 'sqlite', $mail_location = '', $dirs = '', $days file { '/etc/cron.daily/dovecot-expire': owner => root, group => 0, mode => 0755; } + if $type == 'legacy' or $type == 'mixed' { case $mail_location { '': { fail("Need to set \$dovecot_mail_location on $fqdn!") } @@ -19,22 +20,37 @@ class dovecot::expire ( $type = 'sqlite', $mail_location = '', $dirs = '', $days content => "find ${mail_location} -regex '.*/\\.\\(${dirs}\\)\\(/.*\\)?\\/\\(cur\\|new\\)/.*' -type f -ctime +${days} -delete\n" } } else { - case $operatingsystem { - debian: { - augeas { "expire_cron": - context => "/files/etc/default/dovecot/rule", - changes => [ 'set /files/etc/default/dovecot/EXPIRE_CRON \'"daily"\'' ], + # dovecot version 1 way + if $version != 2 { + case $operatingsystem { + debian: { + augeas { "expire_cron": + context => "/files/etc/default/dovecot/rule", + changes => [ 'set /files/etc/default/dovecot/EXPIRE_CRON \'"daily"\'' ], + } } - } - default: { - File['/etc/cron.daily/dovecot-expire']{ - content => "dovecot --exec-mail ext /usr/libexec/dovecot/expire-tool.sh\n" + default: { + File['/etc/cron.daily/dovecot-expire']{ + content => "dovecot --exec-mail ext /usr/libexec/dovecot/expire-tool.sh\n" + } } } + } else { + # dovecot version 2 way (no mail_location, dirs need to be space separated variables and expire script runs doveadm expunge) + # problem with this method is that it doesn't allow for different times for different mailboxes + case $dirs { + '': { $dirs = 'Trash Junk' } + } + case $days { + '': { $days = '14' } + } + File['/etc/cron.daily/dovecot-expire']{ + content => "#!/bin/sh\n\n dirs='${dirs}'\nfor mailbox in \$dirs; do doveadm expunge -A mailbox \$mailbox savedbefore ${days}d; done\n" + } } } - - if $type != 'legacy' and $type != 'mysql' { + + if $type != 'legacy' and $type != 'mysql' and $version != 2 { file{'/etc/dovecot-expire.conf': source => [ "puppet:///modules/site-dovecot/expire/${fqdn}/dovecot-expire.conf", "puppet:///modules/site-dovecot/expire/dovecot-expire.conf", -- cgit v1.2.3 From 1b90c659513b4bee5bcdfd43114c1ee774c5677b Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 11 Nov 2011 12:03:04 -0500 Subject: remove the include ::dovecot from expire.pp, this keeps parameterized classes from working --- manifests/expire.pp | 2 -- 1 file changed, 2 deletions(-) (limited to 'manifests/expire.pp') diff --git a/manifests/expire.pp b/manifests/expire.pp index e5679f4..c0cf8b9 100644 --- a/manifests/expire.pp +++ b/manifests/expire.pp @@ -1,7 +1,5 @@ class dovecot::expire ( $type = 'sqlite', $mail_location = '', $dirs = '', $days = '' ) { - include ::dovecot - file { '/etc/cron.daily/dovecot-expire': owner => root, group => 0, mode => 0755; } -- cgit v1.2.3 From dca386b40c22892245e0a8b9b6ab4853fca1412a Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Wed, 27 Jun 2012 12:18:10 -0400 Subject: switch to 2.7 requirement of underscores instead of hyphens --- manifests/expire.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests/expire.pp') diff --git a/manifests/expire.pp b/manifests/expire.pp index c0cf8b9..bd1a043 100644 --- a/manifests/expire.pp +++ b/manifests/expire.pp @@ -50,8 +50,8 @@ class dovecot::expire ( $type = 'sqlite', $mail_location = '', $dirs = '', $days if $type != 'legacy' and $type != 'mysql' and $version != 2 { file{'/etc/dovecot-expire.conf': - source => [ "puppet:///modules/site-dovecot/expire/${fqdn}/dovecot-expire.conf", - "puppet:///modules/site-dovecot/expire/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'], -- cgit v1.2.3