Bug 1207958

Summary: Manually attached subscriptions in GUI are missing in My Subscriptions tab.
Product: Red Hat Enterprise Linux 6 Reporter: qianzhan
Component: subscription-managerAssignee: Adrian Likins <alikins>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: high Docs Contact:
Priority: medium    
Version: 6.7CC: alikins, dgoodwin, qianzhan, wpoteat
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 06:53:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1125249    
Attachments:
Description Flags
can not open subscription-manager-gui after attaching subscriptions manually in GUI.png
none
auto-attached subscription in GUI
none
manually attached subscription in GUI
none
entitlement.tar
none
sam_install_manifest.zip
none
subscriptions can be displayed.png none

Description qianzhan 2015-04-01 06:08:52 UTC
Description of problem:
Manually attached subscriptions in GUI are missing in My Subscriptions tab.

Version-Release number of selected component (if applicable):
candlepin-0.9.6.5-1.el6sam.noarch
candlepin-scl-1-5.el6_4.noarch
candlepin-scl-quartz-2.1.5-5.el6_4.noarch
candlepin-scl-rhino-1.7R3-1.el6_4.noarch
candlepin-scl-runtime-1-5.el6_4.noarch
candlepin-selinux-0.9.6.5-1.el6sam.noarch
candlepin-tomcat6-0.9.6.5-1.el6sam.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
katello-certs-tools-1.4.2-2.el6sat.noarch
katello-cli-1.4.3.1-1.el6sam.noarch
katello-cli-common-1.4.3.1-1.el6sam.noarch
katello-common-1.4.3.28-1.el6sam_splice.noarch
katello-configure-1.4.5.1-3.el6sam.noarch
katello-glue-candlepin-1.4.3.28-1.el6sam_splice.noarch
katello-glue-elasticsearch-1.4.3.28-1.el6sam_splice.noarch
katello-headpin-1.4.3.28-1.el6sam_splice.noarch
katello-headpin-all-1.4.3.28-1.el6sam_splice.noarch
katello-selinux-1.4.4-2.el6sat.noarch
ruby193-rubygem-katello-redhat-access-engine-0.0.1-1.el6sam.noarch
thumbslug-0.0.40-1.el6sam.noarch
thumbslug-selinux-0.0.40-1.el6sam.noarch
subscription-manager: 1.14.1-1.el6
python-rhsm: 1.14.1-1.el6

How reproducible:
always

Steps to Reproduce:
1. Open subscription-manager-gui.
2. Register and auto-attach.
3. Update available subscriptions, and attach them manually in GUI. Check the attached subscriptions in My Subscriptions tab: Only auto-attached subscription can be seen.

4. List the consumed subscriptions in CLI: the attached subscriptions are in output.


Actual results:
As step 3.

Expected results:
All the attached subscriptions should be displayed in My Subscriptions tab.

Additional info:
When attaching the subscriptions against stage candlepin, all subscriptions can be displayed in My Subscription tab.

Comment 1 qianzhan 2015-04-01 06:19:47 UTC
(In reply to qianzhan from comment #0)

> 
> Steps to Reproduce:
> 1. Open subscription-manager-gui.
> 2. Register and auto-attach.
> 3. Update available subscriptions, and attach them manually in GUI. Check
> the attached subscriptions in My Subscriptions tab: Only auto-attached
> subscription can be seen.
> 
> 4. List the consumed subscriptions in CLI: the attached subscriptions are in
> output.

Step 5. Close subscription-manager-gui, and re-open it: failed. see attachment "can not open subscription-manager-gui after attaching subscriptions manually in GUI.png"

Comment 2 qianzhan 2015-04-01 06:20:16 UTC
Created attachment 1009471 [details]
can not open subscription-manager-gui after attaching subscriptions manually in GUI.png

Comment 4 qianzhan 2015-04-01 06:44:03 UTC
(In reply to qianzhan from comment #0)

> Steps to Reproduce:

> 3. Update available subscriptions, and attach them manually in GUI. Check
> the attached subscriptions in My Subscriptions tab: Only auto-attached
> subscription can be seen.
> 

When manually attaching a subscripion in CLI, it can be displayed in GUI.

Comment 5 J.C. Molet 2015-04-01 15:07:10 UTC
I cannot reproduce this against standalone candlepin using the same version of subscription manager.  Can you provide more info about which subscripiton(s) you are trying to attach and the products you have?  Am I correct in thinking you can only reproduce this against your katello server?

Comment 6 John Sefler 2015-04-01 20:45:53 UTC
Based on the stack trace in attachment 1009471 [details], my guess is that a second subscription that provides for a product that is already installed and auto-subscribed is being manually subscribed and it comes from a different contract number than the subscription that was auto-subscribed.  Therefore the subscription-manager-gui is trying to consolidate all of the contract numbers into a comma separated list and render it as a string the in the Installed Product details pane.   But maybe katello is returning a list of null contracts which is causing the subscription-manager-gui to throw a traceback on bad data.

That's my guess.  I think there is some bad or missing contract data in the subscriptions and either katello is not returning them or subscription-manager is not gracefully handling a missing contract.

Comment 7 qianzhan 2015-04-02 03:09:27 UTC
(In reply to J.C. Molet from comment #5)
> I cannot reproduce this against standalone candlepin using the same version
> of subscription manager.  Can you provide more info about which
> subscripiton(s) you are trying to attach and the products you have?  Am I
> correct in thinking you can only reproduce this against your katello server?

For example, I manually attached the following subscription with SKU MCT2738, and the 'Red Hat Employee Subscription' with SKU SYS0395 is auto-attached during registration.

Attachments 'auto-attanched subscription in GUI.png' and 'manually attached subscription in GUI.png' are references too.

[root@dhcp-128-72 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name:   OpenShift Enterprise Standard, 4 Core, 32 GB
Provides:            Oracle Java (for RHEL Server)
                     Red Hat OpenShift Enterprise Application Node
                     Red Hat Software Collections Beta (for RHEL Server)
                     JBoss Enterprise Web Server
                     Red Hat Enterprise Linux Server
                     Red Hat Beta
                     Red Hat Software Collections (for RHEL Server)
                     Red Hat OpenShift Enterprise Client Tools
SKU:                 MCT2738
Contract:            10697963
Account:             5501040
Serial:              6409221765214751642
Pool ID:             8ac201184c72e65e014c72e9914903d1
Provides Management: Yes
Active:              True
Quantity Used:       1
Service Level:       Standard
Service Type:        L1-L3
Status Details:      Subscription is current
Subscription Type:   Standard
Starts:              12/31/2014
Ends:                12/30/2015
System Type:         Physical

Subscription Name:   Red Hat Employee Subscription
Provides:            Oracle Java (for RHEL Server)
                     Red Hat Enterprise Linux Workstation
                     Red Hat Enterprise Linux Load Balancer (for RHEL Server)
                     Red Hat Enterprise Linux Server
                     Red Hat Enterprise Linux High Availability (for RHEL
                     Server)
                     Red Hat Enterprise Linux Resilient Storage (for RHEL
                     Server)
SKU:                 SYS0395
Contract:            
Account:             5501040
Serial:              2938464246228582804
Pool ID:             8ac201184c72e65e014c72e9904302f5
Provides Management: No
Active:              True
Quantity Used:       1
Service Level:       None
Service Type:        Self-Support
Status Details:      Subscription is current
Subscription Type:   Standard
Starts:              12/31/2014
Ends:                12/30/2015
System Type:         Physical

Comment 8 qianzhan 2015-04-02 03:10:13 UTC
Created attachment 1009932 [details]
auto-attached subscription in GUI

Comment 9 qianzhan 2015-04-02 03:10:58 UTC
Created attachment 1009933 [details]
manually attached subscription in GUI

Comment 10 John Sefler 2015-04-02 13:56:13 UTC
Notice the empty contract number on the Red Hat Employee Subscription in comment 7.  I think that's evidence that my hunch in comment 6 is correct.  For the Product's Subscription Details pane under the Installed Products tab, subscription-manager-gui is trying to concatenate both contract numbers (10697963 and null) from the two subscriptions that provide for the same installed product, Red Hat Enterprise Linux Server, and place it in the Status field.  That's were the traceback is coming from.

Comment 11 Adrian Likins 2015-04-07 15:41:03 UTC
(In reply to John Sefler from comment #10)
> Notice the empty contract number on the Red Hat Employee Subscription in
> comment 7.  I think that's evidence that my hunch in comment 6 is correct. 
> For the Product's Subscription Details pane under the Installed Products
> tab, subscription-manager-gui is trying to concatenate both contract numbers
> (10697963 and null) from the two subscriptions that provide for the same
> installed product, Red Hat Enterprise Linux Server, and place it in the
> Status field.  That's were the traceback is coming from.

Sounds right. installedtab.InstalledProductsTab,_calc_subs_providing populates
the list fed to friendly_join, and there are no None checks there. It needs to learn to tolerate no contract.

That said, does it make sense for a cert to have an order with no contract value?
What changed that causes that?

Comment 14 Adrian Likins 2015-04-07 18:11:43 UTC
https://github.com/candlepin/subscription-manager/pull/1156
has a client change to handle that case.

But the more interesting issue is how did the contract number not get set?

Comment 16 qianzhan 2015-04-09 03:12:26 UTC
Created attachment 1012493 [details]
entitlement.tar

Comment 18 qianzhan 2015-04-09 03:14:16 UTC
Created attachment 1012500 [details]
sam_install_manifest.zip

Comment 20 qianzhan 2015-04-10 05:38:00 UTC
Waiting for new RHEL6.7 build to verify this bug.

Comment 21 qianzhan 2015-04-17 07:24:20 UTC
Created attachment 1015458 [details]
subscriptions can be displayed.png

Comment 22 qianzhan 2015-04-17 07:27:28 UTC
Verified.

Version-Release number of selected component (if applicable):
candlepin-0.9.6.5-1.el6sam.noarch
candlepin-scl-1-5.el6_4.noarch
candlepin-scl-quartz-2.1.5-5.el6_4.noarch
candlepin-scl-rhino-1.7R3-1.el6_4.noarch
candlepin-scl-runtime-1-5.el6_4.noarch
candlepin-selinux-0.9.6.5-1.el6sam.noarch
candlepin-tomcat6-0.9.6.5-1.el6sam.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
katello-certs-tools-1.4.2-2.el6sat.noarch
katello-cli-1.4.3.1-1.el6sam.noarch
katello-cli-common-1.4.3.1-1.el6sam.noarch
katello-common-1.4.3.28-1.el6sam_splice.noarch
katello-configure-1.4.5.1-3.el6sam.noarch
katello-glue-candlepin-1.4.3.28-1.el6sam_splice.noarch
katello-glue-elasticsearch-1.4.3.28-1.el6sam_splice.noarch
katello-headpin-1.4.3.28-1.el6sam_splice.noarch
katello-headpin-all-1.4.3.28-1.el6sam_splice.noarch
katello-selinux-1.4.4-2.el6sat.noarch
ruby193-rubygem-katello-redhat-access-engine-0.0.1-1.el6sam.noarch
thumbslug-0.0.40-1.el6sam.noarch
thumbslug-selinux-0.0.40-1.el6sam.noarch
subscription-manager: 1.14.5-1.el6
python-rhsm: 1.14.2-1.el6

subscription with contract number and subscription without contract number, can both be displayed in 'My Subscriptions' Tab. please see attachment 'subscriptions can be displayed.png'

Moving this bug to VERIFIED.

Comment 23 errata-xmlrpc 2015-07-22 06:53:44 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1345.html