class InventorySync::Async::InventorySelfHostSync

Public Instance Methods

create_facets() { || ... } click to toggle source
# File lib/inventory_sync/async/inventory_self_host_sync.rb, line 6
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

Private Instance Methods

add_missing_insights_facet(uuids_hash) click to toggle source
# File lib/inventory_sync/async/inventory_self_host_sync.rb, line 16
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
request_url() click to toggle source
# File lib/inventory_sync/async/inventory_self_host_sync.rb, line 25
def request_url
  ForemanInventoryUpload.inventory_self_url
end