Sha256: a128be1b940af5e1aa4693ff2409fee1fbe838e6156b0df3fd8611a54db72c36
Contents?: true
Size: 1.01 KB
Versions: 41
Compression:
Stored size: 1.01 KB
Contents
module InventorySync module Async class InventorySelfHostSync < QueryInventoryJob set_callback :step, :around, :create_facets def plan super(ForemanRhCloud.foreman_host.organization) end def create_facets # get the results from the event results = yield add_missing_insights_facet(results.uuid_by_fqdn) unless results.uuid_by_fqdn.empty? results end def rescue_strategy_for_self Dynflow::Action::Rescue::Fail end private def add_missing_insights_facet(uuids_hash) facet = InsightsFacet.find_or_create_by(host_id: ForemanRhCloud.foreman_host.id) do |facet| facet.uuid = uuids_hash.values.first end # fix empty uuid in case the facet already exists facet.update(uuid: uuids_hash.values.first) unless facet.uuid end def request_url ForemanInventoryUpload.inventory_self_url end def action_name 'self host sync' end end end end
Version data entries
41 entries across 41 versions & 1 rubygems