Last active
January 20, 2021 19:26
-
-
Save jeremylenz/8c04583f8293f708d6b421b4a37b6eec to your computer and use it in GitHub Desktop.
create multiple AKs
This file contains 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
include ForemanTasks | |
org = Organization.find_by(name: 'Default Organization') | |
cv = Katello::ContentView.find(2) | |
env = Katello::KTEnvironment.find_by(name: 'Library') | |
2.times do |idx| | |
ak = Katello::ActivationKey.new( | |
name: "ak_#{idx + 1}_#{SecureRandom.uuid.last(4)}", | |
organization: org, | |
content_view: cv, | |
environment: env, | |
) | |
ForemanTasks.async_task(::Actions::Katello::ActivationKey::Create, ak) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment