app/lib/actions/katello/product/create.rb in katello-3.0.0.rc4 vs app/lib/actions/katello/product/create.rb in katello-3.0.0.rc5
- old
+ new
@@ -1,29 +1,34 @@
module Actions
module Katello
module Product
class Create < Actions::EntryAction
def plan(product, organization)
- product.provider = organization.anonymous_provider
- product.organization = 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_create = plan_action(::Actions::Candlepin::Product::Create,
+ :name => product.name,
+ :multiplier => 1,
+ :attributes => [{:name => "arch", :value => "ALL"}])
- cp_id = cp_create.output[:response][:id]
+ 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]
+ sub_create = plan_action(::Actions::Candlepin::Product::CreateUnlimitedSubscription,
+ :owner_key => organization.label,
+ :product_id => cp_id)
- product.save!
- action_subject product, :cp_id => cp_id
+ subscription_id = sub_create.output[:response][:id]
- plan_self
- plan_action Katello::Product::ReindexSubscriptions, product, subscription_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]