Strong check for puppet transaction report

We should check not only class of report, but value of
resource statuses.

Also we should not use default pid to allow running other puppet
instances

Related-Bug: #1552805
Closes-Bug: #1566582
Change-Id: I1dd0c25891c8d064e0f3ab1a12ddb14698070c17
This commit is contained in:
Vladimir Sharshov (warpc) 2016-04-06 18:03:43 +03:00
parent b7812110cc
commit 2915ad5acf
1 changed files with 2 additions and 3 deletions

View File

@ -36,10 +36,9 @@ module MCollective
class Puppetd<RPC::Agent
def startup_hook
@splaytime = @config.pluginconf["puppetd.splaytime"].to_i || 0
@lockfile = @config.pluginconf["puppetd.lockfile"] || "/tmp/fuel-puppetd.lock"
@lockfile = "/tmp/fuel-puppetd.lock"
@log = @config.pluginconf["puppetd.log"] || "/var/log/puppet.log"
@statefile = @config.pluginconf["puppetd.statefile"] || "/var/lib/puppet/state/state.yaml"
@pidfile = @config.pluginconf["puppet.pidfile"] || "/var/run/puppet/agent.pid"
@puppetd = @config.pluginconf["puppetd.puppetd"] ||
"/usr/sbin/daemonize -a \
-l #{@lockfile} \
@ -111,7 +110,7 @@ module MCollective
failed = []
# only generate list of changes and failures if we could parse the
# puppet report
if report.is_a?(Puppet::Transaction::Report)
if report.is_a?(Puppet::Transaction::Report) && report.resource_statuses
report.resource_statuses.each do |name, resource|
changed << name if resource.changed
failed << name if resource.failed