Class: Actions::Candlepin::Product::ContentCreate

Inherits:
Abstract
  • Object
show all
Defined in:
app/lib/actions/candlepin/product/content_create.rb

Instance Method Summary collapse

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/lib/actions/candlepin/product/content_create.rb', line 16

def run
  content_url = input[:content_url]
  if input[:type] == ::Katello::Repository::DEB_TYPE
    # We must retrieve the deb? repository in the run phase, so the latest Pulp version_href
    # is set. This is needed to retrieve the latest repository.deb_content_url_options!
    repository = ::Katello::Repository.find(input[:repository_id])
    content_url += repository.deb_content_url_options
  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