Fixed puppet-check for Puppet 2.6

This commit is contained in:
Ossi Salmi 2011-02-16 11:25:40 +02:00 committed by Timo Mkinen
parent 8d8b496078
commit 2addfac215

View file

@ -5,8 +5,16 @@ require "socket"
Puppet.parse_config
if Puppet.version[/\d+/].to_i >= 2
puppetd = "puppet agent"
pidname = "agent.pid"
else
puppetd = "puppetd"
pidname = "puppetd.pid"
end
# get pid number for puppet or exit if not found
pidfile = Puppet.settings.value("rundir") + "/puppetd.pid"
pidfile = File.join(Puppet.settings.value("rundir"), pidname)
begin
pid = File.new(pidfile, "r").read.to_i
rescue Errno::ENOENT
@ -27,5 +35,5 @@ printf("puppetd dead but pid file exists on host '%s', restarting\n",
begin
exec("service puppet start")
rescue Errno::ENOENT
exec("puppetd")
exec(puppetd)
end