Sha256: b307b2ae41aae1e6648bbd3775870df4e34bd5aef8a4b12ee107eac25378ea28

Contents?: true

Size: 1.42 KB

Versions: 45

Compression:

Stored size: 1.42 KB

Contents

module Actions
  module Katello
    module Product
      class Create < Actions::EntryAction
        def plan(product, organization, subscription_start = nil)
          sequence do
            product.provider = organization.anonymous_provider
            product.organization = organization
            product.setup_label_from_name
            product.cp_id = ::Katello::Product.unused_product_id
            product.save!

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

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

            action_subject product, :cp_id => product.cp_id

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

        def run
          product = ::Katello::Product.find(input[:product][:id])
          product.update_attributes!(:cp_id => input[:cp_id])
        end

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

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
katello-3.15.3.1 app/lib/actions/katello/product/create.rb
katello-3.15.3 app/lib/actions/katello/product/create.rb
katello-3.15.2 app/lib/actions/katello/product/create.rb
katello-3.15.1.1 app/lib/actions/katello/product/create.rb
katello-3.15.1 app/lib/actions/katello/product/create.rb
katello-3.15.0.1 app/lib/actions/katello/product/create.rb
katello-3.15.0 app/lib/actions/katello/product/create.rb
katello-3.15.0.rc2 app/lib/actions/katello/product/create.rb
katello-3.15.0.rc1.3 app/lib/actions/katello/product/create.rb
katello-3.15.0.rc1.2 app/lib/actions/katello/product/create.rb
katello-3.15.0.rc1.1 app/lib/actions/katello/product/create.rb
katello-3.15.0.rc1 app/lib/actions/katello/product/create.rb
katello-3.14.1 app/lib/actions/katello/product/create.rb
katello-3.13.4 app/lib/actions/katello/product/create.rb
katello-3.14.0 app/lib/actions/katello/product/create.rb
katello-3.13.3 app/lib/actions/katello/product/create.rb
katello-3.14.0.rc2 app/lib/actions/katello/product/create.rb
katello-3.13.2 app/lib/actions/katello/product/create.rb
katello-3.14.0.rc1 app/lib/actions/katello/product/create.rb
katello-3.13.1 app/lib/actions/katello/product/create.rb