Guest User

Untitled

a guest
Oct 21st, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. require 'puppet/application'
  2. require 'puppet/application/agent'
  3.  
  4. class Puppet::Application::Unimatrix < Puppet::Application::Agent
  5. def onetime
  6. unless options[:client]
  7. $stderr.puts "onetime is specified but there is no client"
  8. exit(43)
  9. return
  10. end
  11.  
  12. @daemon.set_signal_traps
  13.  
  14. begin
  15. report = Puppet::Transaction::Report.new("unimatrix")
  16. Puppet[:report] = false
  17.  
  18. @agent.run(:report => report)
  19.  
  20. Puppet::Util::FileLocking.writelock(Puppet[:lastrunreport], 0660) do |file|
  21. file.print YAML.dump(report.to_yaml)
  22. end
  23. rescue => detail
  24. puts detail.backtrace if Puppet[:trace]
  25. Puppet.err detail.to_s
  26. end
  27.  
  28. if not report
  29. exit(1)
  30. elsif options[:detailed_exitcodes] then
  31. exit(report.exit_status)
  32. else
  33. exit(0)
  34. end
  35. end
  36. end
Add Comment
Please, Sign In to add comment