Hi,

I want to find a way to make sure that the Nagios configuration is valid 
before performing a reload, and I came up with this:

 exec { 'check_nagios_config':
    subscribe   => File['/etc/nagios/objects'],
    refreshonly => true,
    command   => '/usr/bin/nagios -v /etc/nagios/nagios.cfg',
    path           => '/usr/bin:/usr/sbin:/bin',
  }

  exec { 'reload_nagios':
    command => '/etc/init.d/nagios reload',
    require     => Exec['check_nagios_config'],
  }


And I end up with that when executing it:
info: /etc/nagios/objects: Scheduling refresh of Exec[check_nagios_config]
err: /Stage[main]/Nagios/Exec[check_nagios_config]: Failed to call refresh: 
/usr/bin/nagios -v /etc/nagios/nagios.cfg returned 254 instead of one of 
[0] at /var/puppet/manifests/classes/nagios.pp:28
err: /Stage[main]/Nagios/Exec[reload_nagios]/returns: change from notrun to 
0 failed: /etc/init.d/nagios reload returned 1 instead of one of [0] at 
/var/puppet/manifests/classes/nagios.pp:33

We can see that check_nagios_config returns 254 but reload_nagios would 
still executes. As a require failed it's not supposed to execute or I'm 
missing something?

Thanks

-- 
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/-/4gSvQulkvQIJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to