Method: Puppet::Application::Agent#onetime

Defined in:
lib/vendor/puppet/application/agent.rb

#onetimeObject



329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/vendor/puppet/application/agent.rb', line 329

def onetime
  unless options[:client]
    $stderr.puts "onetime is specified but there is no client"
    exit(43)
    return
  end

  @daemon.set_signal_traps

  begin
    report = @agent.run
  rescue => detail
    puts detail.backtrace if Puppet[:trace]
    Puppet.err detail.to_s
  end

  @daemon.stop(:exit => false)

  if not report
    exit(1)
  elsif options[:detailed_exitcodes] then
    exit(report.exit_status)
  else
    exit(0)
  end
end