Cody Robertson
2013-Jan-16 19:45 UTC
[Puppet Users] Issue with exported resources and "ensure"
Hello folks! I hope everyone is having a great Wednesday! I think I may have come across a bug / a use case which isn''t working properly however I wanted to run it by some eyes on the mailing list before I filed a bug report. I''m attempting to use Hiera with Puppet exported resources (a Nagios module in specific). I don''t believe Hiera is a problem in this instance however I believe it''s worth noting. Here is the snippet that appears to not be working: -- "check_sda7_nrpe_${hostname}": ensure => $nrpe_command_check_sda7, check_command => $nagios_check_sda7_custom ? { yes => "check_disk_nrpe!sda7!$nagios_check_sda7_warn!$nagios_check_sda7_crit", default => "check_disk_nrpe!sda7!20!10", }, use => "generic-service", service_description => "SDA7 Check", host_name => $fqdn; -- The $nrpe_command_check_sda7 variable is pulled via the hiera() function up top. It''s either assigned "absent" or "present" depending on the node. This *is* getting assigned properly (I''ve tested it with notice() in the manifest). -- Jan 16 17:22:03 puppet puppet-master[31413]: (Scope(Class[Nagios::Target::Install])) Variable: absent Jan 16 17:22:03 puppet puppet-master[31413]: Compiled catalog for sng002.xxx.com in environment production in 0.34 seconds -- The Nagios server collects the Nagios_* resources and generates the configurations however it appears the "ensure" portion isn''t working properly. In the above example it''s not removing the Nagios_service resource. If I manually specify "absent" or "present" in the manifest (not using the variable) it works as expected. Am I missing anything obvious in this case? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/UBYF2_uq67EJ. 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.
jcbollinger
2013-Jan-18 16:45 UTC
[Puppet Users] Re: Issue with exported resources and "ensure"
On Wednesday, January 16, 2013 1:45:28 PM UTC-6, Cody Robertson wrote:> > Hello folks! I hope everyone is having a great Wednesday! > > I think I may have come across a bug / a use case which isn''t working > properly however I wanted to run it by some eyes on the mailing list before > I filed a bug report. I''m attempting to use Hiera with Puppet exported > resources (a Nagios module in specific). I don''t believe Hiera is a problem > in this instance however I believe it''s worth noting. > > Here is the snippet that appears to not be working: > > -- > "check_sda7_nrpe_${hostname}": > ensure => $nrpe_command_check_sda7, > check_command => $nagios_check_sda7_custom ? { > yes => > "check_disk_nrpe!sda7!$nagios_check_sda7_warn!$nagios_check_sda7_crit", > default => "check_disk_nrpe!sda7!20!10", > }, > use => "generic-service", > service_description => "SDA7 Check", > host_name => $fqdn; > -- > > The $nrpe_command_check_sda7 variable is pulled via the hiera() function > up top. It''s either assigned "absent" or "present" depending on the node. > This *is* getting assigned properly (I''ve tested it with notice() in the > manifest). > > -- > Jan 16 17:22:03 puppet puppet-master[31413]: > (Scope(Class[Nagios::Target::Install])) Variable: absent > Jan 16 17:22:03 puppet puppet-master[31413]: Compiled catalog for > sng002.xxx.com in environment production in 0.34 seconds > -- > > The Nagios server collects the Nagios_* resources and generates the > configurations however it appears the "ensure" portion isn''t working > properly. In the above example it''s not removing the Nagios_service > resource. If I manually specify "absent" or "present" in the manifest (not > using the variable) it works as expected. > > Am I missing anything obvious in this case? >Yes. You need to check directly what ensure values are being collected. Look at what''s stored in the DB, turn on debug logging everywhere and check those logs, and look at the catalog that the Nagios server receives. Make sure that the node exporting the resources in question synchronizes with the master before you look for the updated values to be passed on to the node collecting them. Frankly, I''m skeptical about the proposition that it makes a difference whether you set an exported resource''s property via a literal or a variable that contains the same value. I don''t think you''re seeing what you think you''re seeing. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/34YOF5gyL6IJ. 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.