Class: ForemanInventoryUpload::Async::GenerateHostReport

Inherits:
Actions::EntryAction
  • Object
show all
Defined in:
lib/foreman_inventory_upload/async/generate_host_report.rb

Instance Method Summary collapse

Instance Method Details

#plan(base_folder, organization_id, filter) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/foreman_inventory_upload/async/generate_host_report.rb', line 4

def plan(base_folder, organization_id, filter)
  plan_self(
    base_folder: base_folder,
    organization_id: organization_id,
    filter: filter
  )
  input[:target] = File.join(base_folder, ForemanInventoryUpload.facts_archive_name(input[:organization_id], input[:filter]))
end

#runObject



13
14
15
16
17
# File 'lib/foreman_inventory_upload/async/generate_host_report.rb', line 13

def run
  archived_report_generator = ForemanInventoryUpload::Generators::ArchivedReport.new(input[:target])
  archived_report_generator.render(organization: input[:organization_id], filter: input[:filter])
  output[:result] = "Generated #{input[:target]} for organization id #{input[:organization_id]}"
end