Fixed puppet-check for Puppet 2.6
This commit is contained in:
parent
8d8b496078
commit
2addfac215
1 changed files with 10 additions and 2 deletions
|
@ -5,8 +5,16 @@ require "socket"
|
||||||
|
|
||||||
Puppet.parse_config
|
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
|
# 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
|
begin
|
||||||
pid = File.new(pidfile, "r").read.to_i
|
pid = File.new(pidfile, "r").read.to_i
|
||||||
rescue Errno::ENOENT
|
rescue Errno::ENOENT
|
||||||
|
@ -27,5 +35,5 @@ printf("puppetd dead but pid file exists on host '%s', restarting\n",
|
||||||
begin
|
begin
|
||||||
exec("service puppet start")
|
exec("service puppet start")
|
||||||
rescue Errno::ENOENT
|
rescue Errno::ENOENT
|
||||||
exec("puppetd")
|
exec(puppetd)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue