Sha256: 10c64c1024e565c28ae07c56aaa288acebcd0d7916d3cf7b4f31d482465e6466

Contents?: true

Size: 1.39 KB

Versions: 17

Compression:

Stored size: 1.39 KB

Contents

module Actions
  module Katello
    module RepositorySet
      class EnableRepository < Actions::EntryAction
        def humanized_name
          _("Enable")
        end

        def plan(product, content, substitutions, override_url: nil,
                 override_arch: 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
          repository.root.arch = override_arch if override_arch.present?
          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

        def run
          repo = ::Katello::Repository.find(input[:repository][:id])
          output[:repository] = {
            :name => repo.name,
            :id => repo.id,
            :content_type => repo.content_type
          }
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
katello-4.13.1 app/lib/actions/katello/repository_set/enable_repository.rb
katello-4.13.0 app/lib/actions/katello/repository_set/enable_repository.rb
katello-4.12.1 app/lib/actions/katello/repository_set/enable_repository.rb
katello-4.13.0.rc1 app/lib/actions/katello/repository_set/enable_repository.rb
katello-4.12.0 app/lib/actions/katello/repository_set/enable_repository.rb
katello-4.12.0.rc3 app/lib/actions/katello/repository_set/enable_repository.rb
katello-4.12.0.rc2 app/lib/actions/katello/repository_set/enable_repository.rb
katello-4.12.0.rc1 app/lib/actions/katello/repository_set/enable_repository.rb
katello-4.11.1 app/lib/actions/katello/repository_set/enable_repository.rb
katello-4.11.0 app/lib/actions/katello/repository_set/enable_repository.rb
katello-4.11.0.rc2 app/lib/actions/katello/repository_set/enable_repository.rb
katello-4.11.0.rc1 app/lib/actions/katello/repository_set/enable_repository.rb
katello-4.10.0 app/lib/actions/katello/repository_set/enable_repository.rb
katello-4.9.2 app/lib/actions/katello/repository_set/enable_repository.rb
katello-4.10.0.rc2 app/lib/actions/katello/repository_set/enable_repository.rb
katello-4.10.0.rc1 app/lib/actions/katello/repository_set/enable_repository.rb
katello-4.9.1 app/lib/actions/katello/repository_set/enable_repository.rb