From d2672d3233675965fd6470eeaaed7a7c7fa36c3f Mon Sep 17 00:00:00 2001 From: Tom McKay Date: Mon, 21 Jul 2014 11:21:52 -0400 Subject: [PATCH] fixes #6702 - use a subscriptions derived provided products --- app/controllers/katello/providers_controller.rb | 5 +++-- app/lib/katello/resources/candlepin.rb | 3 ++- app/models/katello/glue/candlepin/consumer.rb | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/katello/providers_controller.rb b/app/controllers/katello/providers_controller.rb index cc2c445790d..7ffc40079c7 100644 --- a/app/controllers/katello/providers_controller.rb +++ b/app/controllers/katello/providers_controller.rb @@ -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. diff --git a/app/lib/katello/resources/candlepin.rb b/app/lib/katello/resources/candlepin.rb index 642e672e070..f38d7e1b3d0 100644 --- a/app/lib/katello/resources/candlepin.rb +++ b/app/lib/katello/resources/candlepin.rb @@ -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 diff --git a/app/models/katello/glue/candlepin/consumer.rb b/app/models/katello/glue/candlepin/consumer.rb index 1c01c816de5..ea3092e8dd6 100644 --- a/app/models/katello/glue/candlepin/consumer.rb +++ b/app/models/katello/glue/candlepin/consumer.rb @@ -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