Hello ! I''m using a lot of nagios_ commands in my puppet manifests and I saw a problem when using ''undef'' in exported resources : Here is a simple example : define nagios::service::distributed ($ensure=present, $service_description, $host_name=false, $contact_groups=false) { nagios_service {$name: ensure => $ensure, use => "generic-service-active", host_name => $host_name ? {false => $hostname, default => $host_name}, check_command => $name, tag => "nagios", service_description => $service_description, target => "$nagios_cfg_dir/services.cfg", require => File["$nagios_cfg_dir/services.cfg"], notify => Exec["nagios-reload"], } @@nagios_service {"@@$name on $hostname": ensure => $ensure, use => "generic-service-passive", host_name => $host_name ? {false => $hostname, default => $host_name}, tag => "nagios", service_description => $service_description, target => "$nagios_cfg_dir/services.cfg", require => File["$nagios_cfg_dir/services.cfg"], notify => Exec["nagios-reload"], contact_groups => $contact_groups ? {false => undef, default => $contact_groups}, } } and I use this definition like this (without argument $contact_groups) : nagios::service::distributed {"check_local_du": ensure => present, service_description => "disk usage", } In this case, $contact_groups is not defined, so ''undef'' allows you to ignore this attribute. It work fine in nagios_service but in @@nagios_service this attribute is put into the mysql database and collected by the central server as if this attribute value is the string "undef". IMHO this attribute should be ignored and not inserted into the database, right ? Bug or limitation of the keyword ''undef'' ? Thanks in advance, Mathieu --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Peter Meier
2009-Apr-22 13:33 UTC
[Puppet Users] Re: Exported Resources with keyword undef
Hi> In this case, $contact_groups is not defined, so ''undef'' allows you to > ignore this attribute. It work fine in nagios_service but in > @@nagios_service this attribute is put into the mysql database and > collected by the central server as if this attribute value is the > string "undef". > > IMHO this attribute should be ignored and not inserted into the > database, right ? > > Bug or limitation of the keyword ''undef'' ?personally I would see this as a bug, as an exported resource should behave the same way as a local one. Would you mind filing a bug? (Assuming nobody disagrees) cheers pete --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Mathieu Bornoz
2009-Apr-27 07:55 UTC
[Puppet Users] Re: Exported Resources with keyword undef
Ok I will fill a bug report ...> personally I would see this as a bug, as an exported resource should > behave the same way as a local one. > Would you mind filing a bug? (Assuming nobody disagrees)--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Mathieu Bornoz
2009-Apr-27 08:32 UTC
[Puppet Users] Re: Exported Resources with keyword undef
see http://projects.reductivelabs.com/issues/2204 On Mon, Apr 27, 2009 at 9:55 AM, Mathieu Bornoz <mathieu.bornoz@camptocamp.com> wrote:> Ok I will fill a bug report ... > >> personally I would see this as a bug, as an exported resource should >> behave the same way as a local one. >> Would you mind filing a bug? (Assuming nobody disagrees) >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---