Skip to content

Instantly share code, notes, and snippets.

@jeremylenz
Last active January 20, 2021 19:26
Show Gist options
  • Save jeremylenz/8c04583f8293f708d6b421b4a37b6eec to your computer and use it in GitHub Desktop.
Save jeremylenz/8c04583f8293f708d6b421b4a37b6eec to your computer and use it in GitHub Desktop.
create multiple AKs
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