Sha256: ab50b460de79394ac6c695ade9eec268a695df8fcf80d603fe3bcadbfc278c07

Contents?: true

Size: 1.45 KB

Versions: 24

Compression:

Stored size: 1.45 KB

Contents

module Actions
  module Katello
    module Product
      class Create < Actions::EntryAction
        def plan(product, organization)
          sequence do
            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]

            sub_create = plan_action(::Actions::Candlepin::Product::CreateUnlimitedSubscription,
                        :owner_key => organization.label,
                        :product_id => cp_id)

            subscription_id = sub_create.output[:response][:id]

            plan_action(::Actions::Candlepin::Owner::RefreshSubscriptions,
                                  :label => organization.label)
            product.save!
            action_subject product, :cp_id => cp_id

            plan_self
            plan_action Katello::Product::ReindexSubscriptions, product, subscription_id
          end
        end

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

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

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
katello-3.3.2 app/lib/actions/katello/product/create.rb
katello-3.3.1.1 app/lib/actions/katello/product/create.rb
katello-3.3.1 app/lib/actions/katello/product/create.rb
katello-3.3.0.1 app/lib/actions/katello/product/create.rb
katello-3.3.0 app/lib/actions/katello/product/create.rb
katello-3.3.0.rc2 app/lib/actions/katello/product/create.rb
katello-3.3.0.rc1.1 app/lib/actions/katello/product/create.rb
katello-3.3.0.rc1 app/lib/actions/katello/product/create.rb
katello-3.2.1.1 app/lib/actions/katello/product/create.rb
katello-3.2.1 app/lib/actions/katello/product/create.rb
katello-3.2.0 app/lib/actions/katello/product/create.rb
katello-3.2.0.rc3 app/lib/actions/katello/product/create.rb
katello-3.2.0.rc2 app/lib/actions/katello/product/create.rb
katello-3.2.0.rc1.1 app/lib/actions/katello/product/create.rb
katello-3.2.0.rc1 app/lib/actions/katello/product/create.rb
katello-3.1.0.1 app/lib/actions/katello/product/create.rb
katello-3.1.0 app/lib/actions/katello/product/create.rb
katello-3.1.0.rc2.1 app/lib/actions/katello/product/create.rb
katello-3.0.2 app/lib/actions/katello/product/create.rb
katello-3.1.0.rc1 app/lib/actions/katello/product/create.rb