Sha256: bb1cd90a54b2f31e5eb491111150e9fc4dbed5966a7b98c656508fde9fb68459

Contents?: true

Size: 1.12 KB

Versions: 17

Compression:

Stored size: 1.12 KB

Contents

module Actions
  module Pulp
    module Repository
      class Create < Pulp::Abstract
        include Helpers::Presenter

        input_format do
          param :repository_id
          param :capsule_id
        end

        def plan(repository, smart_proxy = SmartProxy.pulp_master!)
          if repository.is_a?(::Katello::ContentViewPuppetEnvironment)
            plan_self(:content_view_puppet_environment_id => repository.id, :capsule_id => smart_proxy.id)
          else
            plan_self(:repository_id => repository.id, :capsule_id => smart_proxy.id)
          end
        end

        def run
          if input[:repository_id]
            repo = ::Katello::Repository.find(input[:repository_id])
          else
            repo = ::Katello::ContentViewPuppetEnvironment.find(input[:content_view_puppet_environment_id]).nonpersisted_repository
          end

          output[:response] = repo.backend_service(smart_proxy(input[:capsule_id])).create
        rescue RestClient::Conflict
          Rails.logger.warn("Tried to add repository #{input[:pulp_id]} that already exists.")
          []
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
katello-3.12.3 app/lib/actions/pulp/repository/create.rb
katello-3.12.2 app/lib/actions/pulp/repository/create.rb
katello-3.12.1 app/lib/actions/pulp/repository/create.rb
katello-3.11.2 app/lib/actions/pulp/repository/create.rb
katello-3.10.2 app/lib/actions/pulp/repository/create.rb
katello-3.12.0 app/lib/actions/pulp/repository/create.rb
katello-3.12.0.rc2 app/lib/actions/pulp/repository/create.rb
katello-3.10.1.1 app/lib/actions/pulp/repository/create.rb
katello-3.12.0.rc1 app/lib/actions/pulp/repository/create.rb
katello-3.10.1 app/lib/actions/pulp/repository/create.rb
katello-3.11.1 app/lib/actions/pulp/repository/create.rb
katello-3.11.0 app/lib/actions/pulp/repository/create.rb
katello-3.11.0.rc2 app/lib/actions/pulp/repository/create.rb
katello-3.11.0.rc1 app/lib/actions/pulp/repository/create.rb
katello-3.10.0 app/lib/actions/pulp/repository/create.rb
katello-3.10.0.rc1.1 app/lib/actions/pulp/repository/create.rb
katello-3.10.0.rc1 app/lib/actions/pulp/repository/create.rb