Bug 1394401 - The list of provided products for Temporary Subscriptions is empty
Summary: The list of provided products for Temporary Subscriptions is empty
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 2.0
Hardware: Unspecified
OS: Unspecified
high
low
Target Milestone: ---
: ---
Assignee: Filip Nguyen
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-11 21:14 UTC by John Sefler
Modified: 2017-01-20 12:22 UTC (History)
6 users (show)

Fixed In Version: candlepin-2.0.22-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-01-20 12:22:21 UTC


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github candlepin candlepin pull 1417 0 None None None 2016-12-12 11:35:37 UTC

Description John Sefler 2016-11-11 21:14:59 UTC
Description of problem:
This appears to be a recent regression...
Using subscription-manager to list available subscription pools from an unmapped virtual system against a master onpremise candlepin deployed with TESTDATA shows that the Temporary Subscriptions have an empty list of Provided Products.

Version-Release number of selected component (if applicable):
Offending Candlpin version...
[root@jsefler-candlepin candlepin]# git log | head -1
commit 3f9d4c6b40d17b39ddafedcf0933895a65497a79
[root@jsefler-rhel6 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.0.19-1
subscription management rules: 5.20
subscription-manager: 1.18.4-1.el6
python-rhsm: 1.18.4-1.el6



How reproducible:


Steps to Reproduce:
[root@jsefler-rhel6 ~]# subscription-manager facts | grep is_guest
virt.is_guest: True
[root@jsefler-rhel6 ~]# subscription-manager register --username=testuser1 --org=admin
Registering to: jsefler-candlepin.usersys.redhat.com:8443/candlepin
Password: 
The system has been registered with ID: adf85aec-dcb8-4f20-a571-ed382c0df862 
[root@jsefler-rhel6 ~]# subscription-manager list --avail | grep Temporary -B11

Subscription Name:   Awesome OS Instance Based (Standard Support)
Provides:            
SKU:                 awesomeos-instancebased
Contract:            1
Pool ID:             8a90860f585526930158552787e90418
Provides Management: No
Available:           20
Suggested:           1
Service Level:       Standard
Service Type:        L1-L3
Subscription Type:   Instance Based (Temporary)
--

Subscription Name:   Admin OS Instance Based one socket
Provides:            
SKU:                 adminos-onesocketib
Contract:            0
Pool ID:             8a90860f5855269301585527811a02f0
Provides Management: No
Available:           10
Suggested:           1
Service Level:       Standard
Service Type:        L1-L3
Subscription Type:   Instance Based (Temporary)
--

Subscription Name:   Awesome OS Unlimited Quantity Virt Limit
Provides:            
SKU:                 awesomeos-ul-quantity-virt
Contract:            1
Pool ID:             8a90860f58552693015855279b23082b
Provides Management: No
Available:           Unlimited
Suggested:           1
Service Level:       
Service Type:        
Subscription Type:   Multi-Entitleable (Temporary)
--

Subscription Name:   Admin OS Instance Based one socket
Provides:            
SKU:                 adminos-onesocketib
Contract:            1
Pool ID:             8a90860f585526930158552783ad0317
Provides Management: No
Available:           20
Suggested:           1
Service Level:       Standard
Service Type:        L1-L3
Subscription Type:   Instance Based (Temporary)
--

Subscription Name:   Awesome OS Instance Based (Standard Support)
Provides:            
SKU:                 awesomeos-instancebased
Contract:            0
Pool ID:             8a90860f585526930158552785f703c3
Provides Management: No
Available:           10
Suggested:           1
Service Level:       Standard
Service Type:        L1-L3
Subscription Type:   Instance Based (Temporary)
--

Subscription Name:   Awesome OS Unlimited Quantity Virt Limit
Provides:            
SKU:                 awesomeos-ul-quantity-virt
Contract:            0
Pool ID:             8a90860f5855269301585527999c07ff
Provides Management: No
Available:           Unlimited
Suggested:           1
Service Level:       
Service Type:        
Subscription Type:   Multi-Entitleable (Temporary)
[root@jsefler-rhel6 ~]# 


Actual results:
  Notice above that every Temporary subscription has an empty Provides list.


Expected results:
  Let's list one of those SKUs, awesomeos-ul-quantity-virt, to see what Provides list is expected...


[root@jsefler-rhel6 ~]# subscription-manager list --avail --matches=awesomeos-ul-quantity-virt
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name:   Awesome OS Unlimited Quantity Virt Limit
Provides:            Awesome OS Server Bits
SKU:                 awesomeos-ul-quantity-virt
Contract:            0
Pool ID:             8a90860f5855269301585527999607fc
Provides Management: No
Available:           Unlimited
Suggested:           1
Service Level:       
Service Type:        
Subscription Type:   Multi-Entitleable
Ends:                11/10/2017
System Type:         Physical

Subscription Name:   Awesome OS Unlimited Quantity Virt Limit
Provides:            Awesome OS Server Bits
SKU:                 awesomeos-ul-quantity-virt
Contract:            1
Pool ID:             8a90860f58552693015855279add0820
Provides Management: No
Available:           Unlimited
Suggested:           1
Service Level:       
Service Type:        
Subscription Type:   Multi-Entitleable
Ends:                11/10/2017
System Type:         Physical

Subscription Name:   Awesome OS Unlimited Quantity Virt Limit
Provides:            
SKU:                 awesomeos-ul-quantity-virt
Contract:            1
Pool ID:             8a90860f58552693015855279b23082b
Provides Management: No
Available:           Unlimited
Suggested:           1
Service Level:       
Service Type:        
Subscription Type:   Multi-Entitleable (Temporary)
Ends:                11/10/2017
System Type:         Virtual

Subscription Name:   Awesome OS Unlimited Quantity Virt Limit
Provides:            
SKU:                 awesomeos-ul-quantity-virt
Contract:            0
Pool ID:             8a90860f5855269301585527999c07ff
Provides Management: No
Available:           Unlimited
Suggested:           1
Service Level:       
Service Type:        
Subscription Type:   Multi-Entitleable (Temporary)
Ends:                11/10/2017
System Type:         Virtual


BANG!
Notice above that the Physical subscriptions provide product "Awesome OS Server Bits" as expected, but the Virtual Temporary pools provide an empty set of products.  Expected "Awesome OS Server Bits" on all pools for awesomeos-ul-quantity-virt.



Additional info:

Comment 1 John Sefler 2016-11-11 21:26:37 UTC
Additional info:
When I downgrade deploy to tag candlepin-2.0.19-1 commit  7cb033aafbd37c7db60fc713fceea43b05977531 the bug goes away.

Therefore the offending code change is located between candlepin master commits
   commit 3f9d4c6b40d17b39ddafedcf0933895a65497a79
   commit 7cb033aafbd37c7db60fc713fceea43b05977531

Comment 2 Filip Nguyen 2016-12-12 07:47:10 UTC
The problem is in method PoolHelper.copyProvidedProducts. The method is used to copy the original pool to UNMAPPED_GUEST_POOL (Temporary pool). The method expects the original pool (the one being copied) to be stored in the database. It is trying to find its provided products in the database. That fails, because the original pool is not yet there.

I will add more defensive code into that method. First I will check whether the pool is already persisted (Pool.id != null). When it is not persisted, I will copy the provided products directly from the original instance.


Note You need to log in before you can comment on or make changes to this bug.