summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2011-07-07 01:21:06 +0200
committermh <mh@immerda.ch>2011-07-07 01:21:06 +0200
commit9a18424b2bdf3506737a28ca56a25e20950d6d68 (patch)
treed965668a7ba506f6b35ffc0df4494931ddb4aa90
parent551b46b257b12b32450607083a7cd644ed0dff58 (diff)
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
-rw-r--r--README17
-rw-r--r--manifests/puppetmaster.pp10
-rw-r--r--manifests/puppetmaster/cleanup_reports.pp19
-rw-r--r--manifests/puppetmaster/cleanup_reports/disable.pp6
4 files changed, 23 insertions, 29 deletions
diff --git a/README b/README
index 69e5928..2063b03 100644
--- a/README
+++ b/README
@@ -62,20 +62,11 @@ Reports cleanup:
---------------
By default we clean up reports older than 30 days. If you want to change
-that, you can subclass puppet::puppetmaster and overwrite the included class and
-include that one instead:
-
-class mypuppetmaster inherits puppet::master {
- Class['puppet::puppetmaster::cleanup_reports']{
- cleanup_older_than => 'absent'
- }
-}
-
-Where 'absent' means not to cleanup records and X any other amount of days.
-
-You can also adjust the locations of the reports to your needs, by setting the param
-`reports_dir` to something different.
+that, you can set $puppetmaster_cleanup_reports to one of the following
+values:
+* 'X', where X is the amount of days you want to keep reports for
+* false, to disable reports cleanup
Check last run:
---------------
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,
+ }
+}