Skip to content

Instantly share code, notes, and snippets.

@jturel
Last active February 11, 2022 16:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jturel/317e9f892fb19e84480880f1f674e74e to your computer and use it in GitHub Desktop.
Save jturel/317e9f892fb19e84480880f1f674e74e to your computer and use it in GitHub Desktop.
SubscriptionFacetPools
# create a new organization $MYORG
org = Organization.find_by_name($MYORG)
hosts = []
50000.times { hosts << { name: SecureRandom.uuid, organization_id: org.id } }
host_ids = ::Host::Managed.import(hosts, validate: false).ids
facets = host_ids.map { |id| { host_id: id } }
facet_ids = Katello::Host::SubscriptionFacet.import(facets, validate: false).ids
pool = Katello::Pool.create!(cp_id: SecureRandom.uuid, organization: org)
facet_pools = facet_ids.map { |facet_id| { pool_id: pool.id, subscription_facet_id: facet_id } }
Katello::SubscriptionFacetPool.import(facet_pools, validate: false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment