Sha256: 5d5b20b6c8b119bcd72b2159f184d9fe33fd5fcef72228860ec23e00289e548e

Contents?: true

Size: 1.16 KB

Versions: 7

Compression:

Stored size: 1.16 KB

Contents

module Actions
  module Katello
    module Product
      class Create < Actions::EntryAction
        def plan(product, organization)
          product.provider = organization.anonymous_provider
          product.organization = organization

          cp_create = plan_action(::Actions::Candlepin::Product::Create,
                                  :name => product.name,
                                  :multiplier => 1,
                                  :attributes => [{:name => "arch", :value => "ALL"}])

          cp_id = cp_create.output[:response][:id]

          plan_action(::Actions::Candlepin::Product::CreateUnlimitedSubscription,
                      :owner_key => organization.label,
                      :product_id => cp_id)
          product.save!
          action_subject product, :cp_id => cp_id

          plan_self
          plan_action Katello::Provider::ReindexSubscriptions, product.provider
        end

        def finalize
          product = ::Katello::Product.find(input[:product][:id])
          product.cp_id = input[:cp_id]
          product.save!
        end

        def humanized_name
          _("Create")
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
katello-2.4.5 app/lib/actions/katello/product/create.rb
katello-2.4.4 app/lib/actions/katello/product/create.rb
katello-2.4.3 app/lib/actions/katello/product/create.rb
katello-2.4.2 app/lib/actions/katello/product/create.rb
katello-2.4.1 app/lib/actions/katello/product/create.rb
katello-2.4.0 app/lib/actions/katello/product/create.rb
katello-2.4.0.rc3 app/lib/actions/katello/product/create.rb