Class: ChefApply::Reporter

Inherits:
Chef::Handler
  • Object
show all
Defined in:
lib/chef_apply/action/reporter.rb

Instance Method Summary collapse

Instance Method Details

#reportObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/chef_apply/action/reporter.rb', line 24

def report
  if exception
    Chef::Log.error("Creating exception report")
  else
    Chef::Log.info("Creating run report")
  end

  # ensure start time and end time are output in the json properly in the event activesupport happens to be on the system
  run_data = data
  run_data[:start_time] = run_data[:start_time].to_s
  run_data[:end_time] = run_data[:end_time].to_s

  Chef::FileCache.store("run-report.json", Chef::JSONCompat.to_json_pretty(run_data), 0640)
end