class HammerCLIForeman::ReportTemplate::ReportDataCommand

Public Instance Methods

default_filename() click to toggle source
# File lib/hammer_cli_foreman/report_template.rb, line 133
def default_filename
  "Report-#{Time.new.strftime("%Y-%m-%d")}.txt"
end
execute() click to toggle source
# File lib/hammer_cli_foreman/report_template.rb, line 139
def execute
  response = send_request
  if response.code == 204
    print_message(_('The report is not ready yet.'))
    HammerCLI::EX_TEMPFAIL
  else
    handle_success(response)
    HammerCLI::EX_OK
  end
end
handle_success(response) click to toggle source
# File lib/hammer_cli_foreman/report_template.rb, line 150
def handle_success(response)
  if option_path
    filepath = store_response(response)
    print_message(_('The response has been saved to %{path}.'), {:path => filepath})
  else
    puts response.body
  end
end