Sha256: aa39dca69f4811da1d07abb6bb839cf4392c6b697afe707343edce1cab3b7dc5

Contents?: true

Size: 1.85 KB

Versions: 29

Compression:

Stored size: 1.85 KB

Contents

module Actions
  module Katello
    module Product
      class ContentCreate < Actions::Base
        middleware.use Actions::Middleware::RemoteAction

        def plan(repository)
          sequence do
            content_create = plan_action(Candlepin::Product::ContentCreate,
                                         name:        repository.name,
                                         type:        repository.content_type,
                                         label:       repository.custom_content_label,
                                         content_url: content_url(repository))

            plan_action(Candlepin::Product::ContentAdd,
                        product_id: repository.product.cp_id,
                        content_id: content_create.output[:response][:id])

            if repository.gpg_key
              plan_action(Candlepin::Product::ContentUpdate,
                          content_id:  content_create.output[:response][:id],
                          name:        repository.name,
                          type:        repository.content_type,
                          label:       repository.custom_content_label,
                          content_url: content_url(repository),
                          gpg_key_url: repository.yum_gpg_key_url)
            end

            plan_self(repository_id: repository.id,
                      content_id: content_create.output[:response][:id])
          end
        end

        def finalize
          repository = ::Katello::Repository.find(input[:repository_id])
          repository.content_id = input[:content_id]
          repository.save!
        end

        private

        def content_url(repository)
          ::Katello::Glue::Pulp::Repos.custom_content_path(repository.product,
                                                           repository.label)
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
katello-3.2.1.1 app/lib/actions/katello/product/content_create.rb
katello-3.2.1 app/lib/actions/katello/product/content_create.rb
katello-3.2.0 app/lib/actions/katello/product/content_create.rb
katello-3.2.0.rc3 app/lib/actions/katello/product/content_create.rb
katello-3.2.0.rc2 app/lib/actions/katello/product/content_create.rb
katello-3.2.0.rc1.1 app/lib/actions/katello/product/content_create.rb
katello-3.2.0.rc1 app/lib/actions/katello/product/content_create.rb
katello-3.1.0.1 app/lib/actions/katello/product/content_create.rb
katello-3.1.0 app/lib/actions/katello/product/content_create.rb
katello-3.1.0.rc2.1 app/lib/actions/katello/product/content_create.rb
katello-3.0.2 app/lib/actions/katello/product/content_create.rb
katello-2.4.5 app/lib/actions/katello/product/content_create.rb
katello-3.1.0.rc1 app/lib/actions/katello/product/content_create.rb
katello-3.0.1 app/lib/actions/katello/product/content_create.rb
katello-2.4.4 app/lib/actions/katello/product/content_create.rb
katello-3.0.0 app/lib/actions/katello/product/content_create.rb
katello-2.4.3 app/lib/actions/katello/product/content_create.rb
katello-3.0.0.rc7 app/lib/actions/katello/product/content_create.rb
katello-3.0.0.rc5 app/lib/actions/katello/product/content_create.rb
katello-2.4.2 app/lib/actions/katello/product/content_create.rb