Class: Actions::SccManager::CreateProduct

Inherits:
Base
  • Object
show all
Includes:
Dynflow::Action::WithSubPlans
Defined in:
app/lib/actions/scc_manager/subscribe_product.rb

Instance Method Summary collapse

Instance Method Details

#create_sub_plansObject



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'app/lib/actions/scc_manager/subscribe_product.rb', line 92

def create_sub_plans
  product = ::Katello::Product.new
  product.name = input[:product_name]
  if ::Katello.const_defined?(:ContentCredential)
    product.gpg_key = ::Katello::ContentCredential.find_by(id: input[:gpg_key], organization: input[:organization_id])
  else
    product.gpg_key = ::Katello::GpgKey.find_by(id: input[:gpg_key], organization: input[:organization_id])
  end
  product.description = input[:product_description]
  trigger(::Actions::Katello::Product::Create,
    product,
    Organization.find(input[:organization_id])).tap do
    output[:product_id] = product.id
  end
end