Issue #3420 has been updated by Bruce Richardson. File naginator.rb.patch added
Hi. I'm attaching an alternative patch to fix this issue. I think it's worth looking at a) because it also fixes a nasty lurking bug in the naginator provider, b) because Robin's patch only works for resources which have _naginator_name as their namevar, which many of them do not, and c) because nagios's object templating feature is very important to anybody who wants Nagios to scale. The current naginator code doesn't allow for nagios object templating at all - at least not using nagios_* resource types, which you would want to do so that you could have proper dependencies. On point a), if you look at the way the provider comments out the _naginator_name parameter, you'll see that it would also alter any record containing the string "_naginator_name". So if somebody gave a nagios_service a service_description containing "_naginator_name", it would be replaced by the gsub. My patch does have the effect that all nagios object always have a "name" property in their nagios config, but that has no harmful side effects beyond making the generated configuration files ever so slightly more verbose. It's not the perfect solution but it makes nagios object templating properly available through Puppet resources *and* it fixes a lurking bug, so I say it's a win. The best fix would be to enhance nagios/base.rb so that it allows you to toggle whether or not the namevar is also written to the nagios config file as "name". And/or to allow a specific "name" to be set. This would be a more elegant solution and would allow the nasty gsub hacks to come out of the naginator provider, making it simpler and cleaner. I think the toggle would be good enough. But I've never dug into Puppet's ruby internals before today (and I had to get this fixed for a work deadline), so I'll leave that for another day. By the way, I see it's been six months with no update on this. Is naginator actively maintained at the moment? If it isn't, I'd be interested in offering my services. No offence meant, if it is actively maintained. ---------------------------------------- Bug #3420: Nagios "name" attribute not output correctly https://projects.puppetlabs.com/issues/3420 Author: Robin Skoglund Status: Investigating Priority: Normal Assignee: Michael DeHaan Category: Target version: Keywords: Branch: I think I've stumbled upon a bug in the way Naginator outputs the Nagios "name" attribute. I have the following `nagios_service` type defined in a manifest: <pre> nagios_service { "jmx-${name}": use => "basic-service", service_description => "JMX $name", check_command => "check_jmx_heap_via_ssh!$name", register => "0", target => "/usr/local/nagios/etc/generated_services/$name.cfg" } </pre> Expected output: <pre> define service { check_command check_jmx_heap_via_ssh!kidkalkulator register 0 name jmx-kidkalkulator service_description JMX kidkalkulator use basic-service } </pre> Actual output: <pre> define service { check_command check_jmx_heap_via_ssh!kidkalkulator register 0 ## --PUPPET_NAME-- (called '_naginator_name' in the manifest) jmx-kidkalkulator-test service_description JMX kidkalkulator use basic-service } </pre> I attached a patch that changes `puppet/provider/naginator.rb` to output as expected, but I am not sure whether the patch will break other parts of Naginator/puppet. -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
