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:



24
25
26
27
28
29
30
31
# File 'app/controllers/concerns/inventory_upload/report_actions.rb', line 24

def report_file(organization_id)
  filename = ForemanInventoryUpload.facts_archive_name(organization_id)
  files = ForemanInventoryUpload.report_file_paths(organization_id)

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

  [filename, files.first]
end

#start_report_generation(organization_id, disconnected) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/concerns/inventory_upload/report_actions.rb', line 13

def start_report_generation(organization_id, disconnected)
  upload = !disconnected
  ForemanTasks.async_task(
    ForemanInventoryUpload::Async::HostInventoryReportJob,
    ForemanInventoryUpload.generated_reports_folder,
    organization_id,
    "", # hosts_filter
    upload
  )
end