class InventorySync::Async::InventorySelfHostSync

Public Instance Methods

create_facets() { || ... } click to toggle source
# File lib/inventory_sync/async/inventory_self_host_sync.rb, line 10
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
plan() click to toggle source
Calls superclass method
# File lib/inventory_sync/async/inventory_self_host_sync.rb, line 6
def plan
  super(ForemanRhCloud.foreman_host.organization)
end
rescue_strategy_for_self() click to toggle source
# File lib/inventory_sync/async/inventory_self_host_sync.rb, line 18
def rescue_strategy_for_self
  Dynflow::Action::Rescue::Fail
end

Private Instance Methods

action_name() click to toggle source
# File lib/inventory_sync/async/inventory_self_host_sync.rb, line 37
def action_name
  'self host sync'
end
add_missing_insights_facet(uuids_hash) click to toggle source
# File lib/inventory_sync/async/inventory_self_host_sync.rb, line 24
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 33
def request_url
  ForemanInventoryUpload.inventory_self_url
end