purplehazech / puppet-syslogng

Puppet module for managing syslog-ng.
http://forge.puppetlabs.com/purplehazech/syslogng
GNU Affero General Public License v3.0
4 stars 12 forks source link

Please allow purging of the config file directories #5

Closed olasd closed 10 years ago

olasd commented 11 years ago

Hi.

I just started using your syslogng module at work, and it does a great job at managing the config, thanks!

However, while prototyping our config, we accumulated a lot of config snippets that never got cleared.

Would it be possible to add a config knob to purge the config snippets?

For reference, the diff we made locally is as such:

diff --git a/modules/syslogng/manifests/init.pp b/modules/syslogng/manifests/init.pp
index 666aa5e..791df65 100644
--- a/modules/syslogng/manifests/init.pp
+++ b/modules/syslogng/manifests/init.pp
@@ -137,8 +137,9 @@ class syslogng (
     "${conf_dir}/modules.conf":
       ensure => $ensure_file,
       source => 'puppet:///modules/syslogng/scl/modules.conf';
+    "${log_dir}/syslog":
+      ensure => $ensure_directory;
     [
-      "${log_dir}/syslog",
       "${conf_dir}/patterndb.d",
       "${conf_dir}/syslog-ng.conf.d",
       "${conf_dir}/syslog-ng.conf.d/destination.d",
@@ -147,7 +148,10 @@ class syslogng (
       "${conf_dir}/syslog-ng.conf.d/log.d",
       "${conf_dir}/syslog-ng.conf.d/option.d",
     ]:
-      ensure => $ensure_directory;
+      ensure  => $ensure_directory,
+      purge   => true,
+      force   => true,
+      recurse => true;
     "${conf_dir}/syslog-ng.conf.d/option.d/default.conf":
       ensure  => $ensure_file,
       content => $default_conf;

If you think this feature is worthwile, I can make a cleaner diff with tests and all.

Cheers, Nicolas

hairmare commented 11 years ago

Hi Nicolas

I think this feature is more than worthwile and will happily accept it.

I should be configurable through some class parameters. I believe the default should be not to activate the feature since the recurse flag may be very resource intensive on larger directories.

Thanks Lucas

hairmare commented 10 years ago

Merged and released to the forge.

Thanks for the change.