Last active
January 20, 2021 20:57
-
-
Save jeremylenz/4f5d0b6c33bbdb3082d4587de2c34b64 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make a new product from an existing custom product | |
# and attach an existing pool | |
def make_new_product(product, pool, ak) | |
new_prod = product.dup | |
new_prod.name += ' ' + SecureRandom.uuid | |
new_prod.label = new_prod.name.gsub(/ /, '_').gsub(/[()]/, '_') | |
new_prod.save! | |
new_prod.pools << pool | |
# ak.products << new_prod | |
# ak.subscribe(pool.cp_id) | |
new_prod | |
end | |
ak = Katello::ActivationKey.find_by(name: 'My Activation Key') | |
product = Katello::Product.find_by(name: "My Product") | |
pool = product.pools.first | |
5.times do | |
make_new_product(product, pool, ak) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment