Class: Actions::Katello::RepositorySet::EnableRepository
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::Katello::RepositorySet::EnableRepository
- Defined in:
- app/lib/actions/katello/repository_set/enable_repository.rb
Instance Method Summary collapse
- #humanized_name ⇒ Object
- #plan(product, content, substitutions, override_url: nil) ⇒ Object
- #run ⇒ Object
Instance Method Details
#humanized_name ⇒ Object
5 6 7 |
# File 'app/lib/actions/katello/repository_set/enable_repository.rb', line 5 def humanized_name _("Enable") end |
#plan(product, content, substitutions, override_url: nil) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/lib/actions/katello/repository_set/enable_repository.rb', line 9 def plan(product, content, substitutions, override_url: nil) mapper = ::Katello::Candlepin::RepositoryMapper.new(product, content, substitutions) mapper.validate! if mapper.find_repository fail ::Katello::Errors::ConflictException, _("The repository is already enabled") end repository = mapper.build_repository if override_url repository.root.url = override_url repository.root.download_policy = ::Katello::RootRepository::DOWNLOAD_IMMEDIATE if URI(override_url).scheme == 'file' end plan_action(Repository::Create, repository, clone: false) action_subject(repository) plan_self end |
#run ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'app/lib/actions/katello/repository_set/enable_repository.rb', line 27 def run repo = ::Katello::Repository.find(input[:repository][:id]) output[:repository] = { :name => repo.name, :id => repo.id, :content_type => repo.content_type } end |