Skip to content

Instantly share code, notes, and snippets.

@dLobatog
Created April 10, 2019 12:38
Show Gist options
  • Select an option

  • Save dLobatog/866c349ff4a262473fac7f883a030d72 to your computer and use it in GitHub Desktop.

Select an option

Save dLobatog/866c349ff4a262473fac7f883a030d72 to your computer and use it in GitHub Desktop.

Host.all.map do |host|
inventory_host = HostInventoryAPI.new(host, Account.find("9f6f30ee-dd69-42e6-bfc0-374e85e3cdc7"), Settings.host_inventory_url, b64identity).host_already_in_inventory
if inventory_host
old_id = host.id
host.update(id: inventory_host.id)
ProfileHost.where(host_id: old_id).update_all(host_id: inventory_host.id)
RuleResult.where(host_id: old_id).update_all(host_id: inventory_host.id)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment