class ForemanMaintain::Cli::ReportCommand

Public Instance Methods

execute() click to toggle source
# File lib/foreman_maintain/cli/report_command.rb, line 8
def execute
  scenario = run_scenario(Scenarios::Report::Generate.new({}, [:reports])).first

  # description can be used too
  report_data = scenario.steps.map(&:data).compact.reduce(&:merge).transform_keys(&:to_s)
  report_data['version'] = 1
  yaml = report_data.to_yaml
  if @output
    File.write(@output, yaml)
  else
    puts yaml
  end
  exit runner.exit_code
end