Sha256: 186aa36c4aca07cf25fea02d9448f242965ce1673882134fa24ebb6d477e2681
Contents?: true
Size: 1.97 KB
Versions: 6
Compression:
Stored size: 1.97 KB
Contents
module Actions module Katello module Repository class Create < Actions::EntryAction def plan(repository, clone = false, plan_create = false) repository.save! root = repository.root action_subject(repository) org = repository.organization pulp2_create_action = plan_create ? Actions::Pulp::Repository::CreateInPlan : Actions::Pulp::Repository::Create sequence do create_action = plan_action(PulpSelector, [pulp2_create_action, Pulp3::Orchestration::Repository::Create], repository, SmartProxy.pulp_master) return if create_action.error # when creating a clone, the following actions are handled by the # publish/promote process unless clone view_env = org.default_content_view.content_view_environment(org.library) if repository.product.redhat? plan_action(Actions::Candlepin::Environment::AddContentToEnvironment, :view_env_cp_id => view_env.cp_id, :content_id => repository.content_id) else content_create = plan_action(Katello::Product::ContentCreate, root) plan_action(Actions::Candlepin::Environment::AddContentToEnvironment, :view_env_cp_id => view_env.cp_id, :content_id => content_create.input[:content_id]) end end concurrence do plan_self(:repository_id => repository.id, :clone => clone) end end end def run ::User.current = ::User.anonymous_api_admin unless input[:clone] repository = ::Katello::Repository.find(input[:repository_id]) ForemanTasks.async_task(Katello::Repository::MetadataGenerate, repository, repository_creation: true) end ensure ::User.current = nil end def humanized_name _("Create") end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems