diff options
Diffstat (limited to 'lib/puppet/application/puppetd.rb')
-rw-r--r-- | lib/puppet/application/puppetd.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/puppet/application/puppetd.rb b/lib/puppet/application/puppetd.rb index 4799d5571..c1f733183 100644 --- a/lib/puppet/application/puppetd.rb +++ b/lib/puppet/application/puppetd.rb @@ -21,6 +21,7 @@ Puppet::Application.new(:puppetd) do { :waitforcert => 120, # Default to checking for certs every 5 minutes :onetime => false, + :detailed_exitcodes => false, :verbose => false, :debug => false, :centrallogs => false, @@ -65,6 +66,10 @@ Puppet::Application.new(:puppetd) do options[:waitforcert] = 0 unless @explicit_waitforcert end + option("--detailed-exitcodes") do |arg| + options[:detailed_exitcodes] = true + end + option("--logdest DEST", "-l DEST") do |arg| begin Puppet::Util::Log.newdestination(arg) @@ -95,19 +100,25 @@ Puppet::Application.new(:puppetd) do unless options[:client] $stderr.puts "onetime is specified but there is no client" exit(43) + return end @daemon.set_signal_traps begin - @agent.run + report = @agent.run rescue => detail if Puppet[:trace] puts detail.backtrace end Puppet.err detail.to_s end - exit(0) + + if not Puppet[:noop] and options[:detailed_exitcodes] then + exit(report.exit_status) + else + exit(0) + end end command(:main) do @@ -125,6 +136,7 @@ Puppet::Application.new(:puppetd) do Puppet.settings.handlearg("--no-daemonize") options[:verbose] = true options[:onetime] = true + options[:detailed_exitcodes] = true options[:waitforcert] = 0 end |