Issue #6255 has been updated by Gustavo Fernandes.

We had the same issues in our servers, puppet kick was exiting with status 0 
when one or more nodes were getting error. We solved with a simple patch in the 
/usr/lib64/ruby/site_ruby/1.8/puppet/application/kick.rb file:

    --- kick.rb      2012-03-06 23:29:44.000000000 +0000
    +++ kick.rb      2012-03-06 23:29:44.000000000 +0000
    @@ -258,8 +258,21 @@
    :ignoreschedules => options[:ignoreschedules]
    }
    run = Puppet::Run.indirection.save(Puppet::Run.new( run_options ), url)
    +      report = run.options[:report]
    +      report_error = false
    +      report.logs.each do |log|
    +          if log.level == :err
    +             puts log.message
    +             report_error = true
    +          end
    +      end
    +
    puts "Getting status"
    -      result = run.status
    +      if(report_error == false)
    +          result = run.status
    +      else
    +          result = "Manifest error"
    +      end
    puts "status is #{result}"
    rescue => detail
    puts detail.backtrace if Puppet[:trace]

That causes the kick to report errors like this:

    # puppet kick --host myhost123 --foreground --debug
    Host myhost123 returned unknown answer 'Manifest error'
    change from running to stopped failed: Could not stop Service[myservice]: 
Execution of '/sbin/service myservice stop' returned 1:  at 
/etc/puppet/modules/mymodule/manifests/init.pp:97
    Getting status
    status is Manifest error
    myhost123 finished with exit code 12

Very useful when you are kicking 10+ servers since it points to the root of the 
problem and avoid having to keep tailing each node's log. it requires, 
obviously, --foreground to wait until all the runs happens in all nodes

----------------------------------------
Bug #6255: Puppet kick exists with 0 even when puppet run has failures
https://projects.puppetlabs.com/issues/6255#change-68566

Author: Jeffrey Lensen
Status: Accepted
Priority: Low
Assignee: 
Category: agent
Target version: 3.x
Affected Puppet version: 2.6.1
Keywords: kick
Branch: 


When I run a puppet kick from a remote server and the puppet run on the other 
host encounters failures during a run, it still exits with 0 and says 
everything was successful.

$ puppet kick --foreground host ; echo $?
Triggering host
Getting status
status is success
host finished with exit code 0
Finished
0

Wouldn't it make more sense to exit with something other than 0 so you can 
easily determine if the puppet run was actually successful or not?


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to