ghoneycutt / puppet-module-rsyslog

Puppet module to manage rsyslog
Other
3 stars 24 forks source link

Fragments from multiple hiera hierarchies #41

Open voxter opened 10 years ago

voxter commented 10 years ago

I have a couple hierarchies in hiera as follows:

:hierarchy:

When specifying rsyslog fragments in multiple hierarchies, the first match is treated exclusively. I'm sure this is expected behavior due to the hiera syntax, I'm curious if you know of a good way around it without duplicating code?

ie. in global.yaml:

rsyslog::rsyslog_fragments: 5-rate-limits: content: "$SystemLogRateLimitInterval 0\n$SystemLogRateLimitBurst 0\n"

then in hostgroup/somegroup.yaml: rsyslog::rsyslogfragments: somegroup: content: "._ @@somegroup.logserver"

"somegroup" is retained in /etc/rsyslog.d/ and 5-rate-limits is completely ignored. It would be great to have them combine, if at all possible?

ghoneycutt commented 10 years ago

at line 59 of manifests/init.pp change it to look like https://github.com/ghoneycutt/puppet-module-ssh/blob/master/manifests/init.pp#L549-558

If you specify the option, we want the ability to use hiera_hash() which will pull all of the found fragments instead of stopping at the first one.

voxter commented 10 years ago

Brilliant, thank you!

Are you going to make this patch on your own, or would you like me to issue a pull request?

I added at line 10: $hiera_merge = false,

And changed the code block at line 59 to read:

if $rsyslog_fragments != undef { if $hiera_merge == true { $rsyslog_fragments_real = hiera_hash('rsyslog::rsyslog_fragments') } else { $rsyslog_fragments_real = $rsyslog_fragments notice('rsyslog::rsyslog_fragments has hiera_merge_real beliving to be false.') } validate_hash($rsyslog_fragments_real) create_resources('rsyslog::fragment', $rsyslog_fragments_real) }

And enable it via rsyslog::hiera_merge: true in my hiera yaml definition.

voxter commented 10 years ago

Woops, left an extra notice debug in my paste by mistake.

ghoneycutt commented 10 years ago

Could you please submit a pull request and close this issue? I'm more than happy to help you through the process.