Module: InventoryUpload::ReportActions

Extended by:
ActiveSupport::Concern
Included in:
Api::V2::RhCloud::InventoryController, ForemanInventoryUpload::ReportsController, ForemanInventoryUpload::UploadsController
Defined in:
app/controllers/concerns/inventory_upload/report_actions.rb

Defined Under Namespace

Classes: ReportMissingError

Instance Method Summary collapse

Instance Method Details

#report_file(organization_id) ⇒ Object

Raises:



17
18
19
20
21
22
23
24
# File 'app/controllers/concerns/inventory_upload/report_actions.rb', line 17

def report_file(organization_id)
  filename = ForemanInventoryUpload.facts_archive_name(organization_id)
  files = Dir["{#{ForemanInventoryUpload.uploads_file_path(filename)},#{ForemanInventoryUpload.done_file_path(filename)}}"]

  raise ReportMissingError.new(filename: filename) if files.empty?

  [filename, files.first]
end

#start_report_generation(organization_id, disconnected) ⇒ Object



13
14
15
# File 'app/controllers/concerns/inventory_upload/report_actions.rb', line 13

def start_report_generation(organization_id, disconnected)
  ForemanTasks.async_task(ForemanInventoryUpload::Async::GenerateReportJob, ForemanInventoryUpload.generated_reports_folder, organization_id, disconnected)
end