Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #6702 - use a subscriptions derived provided products #4475

Merged
merged 1 commit into from Jul 30, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/controllers/katello/providers_controller.rb
Expand Up @@ -33,8 +33,9 @@ def redhat_provider_tab

subscriptions = Resources::Candlepin::Subscription.get_for_owner(current_organization.label)
subscriptions.each do |sub|
subscription_product_ids << sub["product"]["id"] if sub["product"]["id"]
subscription_product_ids += sub["providedProducts"].map{|p| p["id"]}
subscription_product_ids << sub['product']['id'] if sub['product']['id']
subscription_product_ids += sub['providedProducts'].map{|p| p['id']} if sub['providedProducts']
subscription_product_ids += sub['derivedProvidedProducts'].map{|p| p['id']} if sub['derivedProvidedProducts']
end

orphaned_product_ids = current_organization.redhat_provider.products.engineering.
Expand Down
3 changes: 2 additions & 1 deletion app/lib/katello/resources/candlepin.rb
Expand Up @@ -659,7 +659,8 @@ def _certificate_and_key(id, owner)

product_subscription = subscriptions.find do |sub|
sub["product"]["id"] == id ||
sub["providedProducts"].any? { |provided| provided["id"] == id }
sub["providedProducts"].any? { |provided| provided["id"] == id } ||
sub["derivedProvidedProducts"].any? { |provided| provided["id"] == id }
end

if product_subscription
Expand Down
2 changes: 1 addition & 1 deletion app/models/katello/glue/candlepin/consumer.rb
Expand Up @@ -408,7 +408,7 @@ def available_pools_full(listall = false)
end

provided_products = []
pool["providedProducts"].each do |cp_product|
pool['providedProducts'].each do |cp_product|
product = Katello::Product.where(:cp_id => cp_product["productId"]).first
if product
provided_products << product
Expand Down