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



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

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
  )

  # Ensure insights UUID matches subscription UUID (only runs in IoP mode per method guard above)
  @host.ensure_iop_insights_uuid

  # 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

#update_insights_client_statusObject



36
37
38
39
40
41
42
# File 'app/controllers/concerns/insights_cloud/package_profile_upload_extensions.rb', line 36

def update_insights_client_status
  # Update InsightsClientReportStatus whenever host checks in via subscription-manager
  # This ensures USER_OMITTED status gets set even when insights-client isn't installed
  # (parameter=false means insights-client won't be installed, so it won't hit MachineTelemetriesController)
  @host.get_status(InsightsClientReportStatus).refresh!
  @host.refresh_global_status!
end