Sha256: b19f680f623b3c4419ed4ecffbe0e377c44cabd1db3270d655b15b26786efb18

Contents?: true

Size: 1.42 KB

Versions: 16

Compression:

Stored size: 1.42 KB

Contents

module Actions
  module Candlepin
    module Product
      class Update < Candlepin::Abstract
        def plan(product)
          product.deleted_content.each do |product_content|
            plan_action(::Actions::Candlepin::Product::ContentRemove,
                        :owner => product.organization.label,
                        :product_id => product.cp_id,
                        :content_id => product_content.content.id)
            plan_action(::Actions::Candlepin::Product::ContentDestroy,
                        :owner => product.organization.label,
                        :content_id => product_content.content.id)
          end

          product.added_content.each do |pc|
            content_create = plan_action(::Actions::Candlepin::Product::ContentCreate,
                                         :owner => product.organization.label,
                                         :name => pc.content.name,
                                         :type => pc.content.type,
                                         :label => pc.content.label,
                                         :content_url => pc.content.contentUrl)
            plan_action(::Actions::Candlepin::Product::ContentAdd,
                        :owner => product.organization.label,
                        :product_id => product.cp_id,
                        :content_id => content_create.output[:response][:id])
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
katello-3.5.2 app/lib/actions/candlepin/product/update.rb
katello-3.5.1.1 app/lib/actions/candlepin/product/update.rb
katello-3.5.1 app/lib/actions/candlepin/product/update.rb
katello-3.5.0.1 app/lib/actions/candlepin/product/update.rb
katello-3.5.0 app/lib/actions/candlepin/product/update.rb
katello-3.5.0.rc2 app/lib/actions/candlepin/product/update.rb
katello-3.5.0.rc1 app/lib/actions/candlepin/product/update.rb
katello-3.4.5 app/lib/actions/candlepin/product/update.rb
katello-3.4.4 app/lib/actions/candlepin/product/update.rb
katello-3.4.2 app/lib/actions/candlepin/product/update.rb
katello-3.4.1 app/lib/actions/candlepin/product/update.rb
katello-3.4.0.2 app/lib/actions/candlepin/product/update.rb
katello-3.4.0.1 app/lib/actions/candlepin/product/update.rb
katello-3.4.0 app/lib/actions/candlepin/product/update.rb
katello-3.4.0.rc2 app/lib/actions/candlepin/product/update.rb
katello-3.4.0.rc1 app/lib/actions/candlepin/product/update.rb