Sha256: ac8ee735dabb01174db73a7802bf23586f635a673158315adbc20ab890a9f801

Contents?: true

Size: 1.37 KB

Versions: 3

Compression:

Stored size: 1.37 KB

Contents

module Actions
  module Candlepin
    module Product
      class ContentCreate < Candlepin::Abstract
        input_format do
          param :name
          param :type
          param :arches
          param :label
          param :content_url
          param :owner
          param :os_versions
          param :repository_id
        end

        def run
          content_url = input[:content_url]
          if input[:type] == ::Katello::Repository::DEB_TYPE
            # We must retrieve the repository in the run phase, so the latest Pulp version_href is
            # already set. This is needed to retrieve the latest repository.deb_content_url_options!
            repository = ::Katello::Repository.find(input[:repository_id])
            if repository.deb_using_structured_apt?
              content_url += repository.deb_content_url_options
            end
          end

          output[:response] = ::Katello::Resources::Candlepin::Content.
              create(input[:owner],
                     name: input[:name],
                     contentUrl: content_url,
                     type: input[:type],
                     arches: input[:arches],
                     label: input[:label],
                     requiredTags: input[:os_versions],
                     metadataExpire: 1,
                     vendor: ::Katello::Provider::CUSTOM)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
katello-4.15.0 app/lib/actions/candlepin/product/content_create.rb
katello-4.15.0.rc2 app/lib/actions/candlepin/product/content_create.rb
katello-4.15.0.rc1 app/lib/actions/candlepin/product/content_create.rb