Module: InsightsCloud::PackageProfileUploadExtensions

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb

Instance Method Summary collapse

Instance Method Details

#generate_host_reportObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb', line 12

def generate_host_report
  return unless ForemanRhCloud.with_iop_smart_proxy?

  logger.debug("Generating host-specific report for host #{@host.name}")

  ForemanTasks.async_task(
    ForemanInventoryUpload::Async::SingleHostReportJob,
    ForemanInventoryUpload.generated_reports_folder,
    @host.organization_id,
    @host.id
  )

  # in IoP case, the hosts are identified by the sub-man ID, and we can assume they already
  # exist in the local inventory. This will also handle facet creation for new hosts.
  return if @host.insights

  insights_facet = @host.build_insights(uuid: @host.subscription_facet.uuid)
  insights_facet.save
end