From 9a18424b2bdf3506737a28ca56a25e20950d6d68 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 7 Jul 2011 01:21:06 +0200 Subject: Revert "migrate cleanup_reports to parametrized classes as this makes it much more configurable" This reverts commit 0f4718f062f7419092f69dcdd951339a466a79b8. Unfortuantely due to puppet bug #5517 we currently can't do it that nice so we need to hack around things https://projects.puppetlabs.com/issues/5517 --- manifests/puppetmaster.pp | 10 ++++++++-- manifests/puppetmaster/cleanup_reports.pp | 19 +++++-------------- manifests/puppetmaster/cleanup_reports/disable.pp | 6 ++++++ 3 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 manifests/puppetmaster/cleanup_reports/disable.pp (limited to 'manifests') diff --git a/manifests/puppetmaster.pp b/manifests/puppetmaster.pp index 55e1dab..3e8711c 100644 --- a/manifests/puppetmaster.pp +++ b/manifests/puppetmaster.pp @@ -29,8 +29,14 @@ class puppet::puppetmaster inherits puppet { include puppet::puppetmaster::cluster } - class{'puppet::puppetmaster::cleanup_reports': - cleanup_older_than => '30', + case $puppetmaster_cleanup_reports { + '': { $puppetmaster_cleanup_reports = '30' } + } + + if $puppetmaster_cleanup_reports { + include puppet::puppetmaster::cleanup_reports + } else { + include puppet::puppetmaster::cleanup_reports::disable } if $use_shorewall { diff --git a/manifests/puppetmaster/cleanup_reports.pp b/manifests/puppetmaster/cleanup_reports.pp index d25e8ac..664bd81 100644 --- a/manifests/puppetmaster/cleanup_reports.pp +++ b/manifests/puppetmaster/cleanup_reports.pp @@ -1,17 +1,8 @@ -class puppet::puppetmaster::cleanup_reports( - $cleanup_older_than = 'absent', - $reports_dir = '/var/lib/puppet/reports/' -){ - file { '/etc/cron.daily/puppet_reports_cleanup.sh': } +class puppet::puppetmaster::cleanup_reports { - if $cleanup_older_than != 'absent' { - File['/etc/cron.daily/puppet_reports_cleanup.sh']{ - content => "#!/bin/bash\nfind ${puppet::puppetmaster::cleanup_reports::reports_dir} -maxdepth 2 -type f -ctime +${puppet::puppetmaster::cleanup_reports::cleanup_olderthan} -exec rm {} \\;\n", - owner => root, group => 0, mode => 0700, - } - } else { - File['/etc/cron.daily/puppet_reports_cleanup.sh']{ - ensure => absent, - } + # clean up reports older than $puppetmaster_cleanup_reports days + file { '/etc/cron.daily/puppet_reports_cleanup.sh': + content => "#!/bin/bash\nfind /var/lib/puppet/reports/ -maxdepth 2 -type f -ctime +${puppetmaster_cleanup_reports} -exec rm {} \\;\n", + owner => root, group => 0, mode => 0700; } } diff --git a/manifests/puppetmaster/cleanup_reports/disable.pp b/manifests/puppetmaster/cleanup_reports/disable.pp new file mode 100644 index 0000000..8636223 --- /dev/null +++ b/manifests/puppetmaster/cleanup_reports/disable.pp @@ -0,0 +1,6 @@ +class puppet::puppetmaster::cleanup_reports::disable inherits puppet::puppetmaster::cleanup_reports { + + File['/etc/cron.daily/puppet_reports_cleanup.sh']{ + ensure => absent, + } +} -- cgit v1.2.3