Bug 709412

Summary: subscription manager cli uses product name comparisons in the list command
Product: Red Hat Enterprise Linux 6 Reporter: Bryan Kearney <bkearney>
Component: subscription-managerAssignee: Bryan Kearney <bkearney>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: high Docs Contact:
Priority: urgent    
Version: 6.1CC: adellape, alikins, andriusb, dgregor, jwest, mkhusid, spurrier, xdmoon
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Two variations were used in the ProductName parameter for the workstation subscription: "Red Hat Enterprise Linux Workstation" and "Red Hat Enterprise Linux 6 Workstation". As a consequence, users running the "subscription-manager list --installed" command, while subscribed to the "Red Hat Enterprise Linux Workstation" subscription, got a misleading report. With this update, the ProductId parameter is used instead to compare subscriptions in the described scenario, and the bug no longer occurs.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 17:14:50 UTC Type: ---
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: 568421, 675214, 682238, 712130    
Attachments:
Description Flags
product "Red Hat Enterprise Linux 6 Workstation" shows as being installed and subscribed in the gui none

Description Bryan Kearney 2011-05-31 16:32:12 UTC
The workstation product id has a different name than the entitlement subscriptions. If a customer consumes a workstation subscription the GUI will show the product as being covered by an entitlement. The cli will not. This is because managerlib is using the product name to show the comparisons.

Steps to reproduce:

1) Install RHEL Workstation 6.1
2) Consume a Workstation subscription via the GUI.
3) Note on the main pane that you are in compliance.
4) From the command line, run subscription-manager list
5) Note your lack of compliance.

This is the client side bug which is a result of 707325. We will want an async errata for this.

Comment 1 Andrius Benokraitis 2011-05-31 18:07:00 UTC
Is RHEL 5.7 also affected?

Comment 4 John Sefler 2011-06-02 22:31:04 UTC
Created attachment 502669 [details]
product "Red Hat Enterprise Linux 6 Workstation" shows as being installed and subscribed in the gui

This is a re-create to demonstrate the problem on version...
[root@jsefler-stage-6workstation ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Workstation release 6.1 (Santiago)
[root@jsefler-stage-6workstation ~]# rpm -qa | grep subscription-manager
subscription-manager-0.95.14-1.el6_1.x86_64
subscription-manager-firstboot-0.95.14-1.el6_1.x86_64
subscription-manager-gnome-0.95.14-1.el6_1.x86_64


[root@jsefler-stage-6workstation ~]# subscription-manager register --username=stage_test_27
Password: 
f97ec64f-0c99-41de-a94b-f427309d674b jsefler-stage-6workstation.usersys.redhat.com
[root@jsefler-stage-6workstation ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+

ProductName:        	Red Hat Enterprise Linux 6 Workstation
Status:             	Not Subscribed           
Expires:            	                         
Subscription:       	                         
ContractNumber:     	                         
AccountNumber:      	                         

[root@jsefler-stage-6workstation ~]# subscription-manager list --avail
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+


ProductName:       	Red Hat Enterprise Linux Workstation, Standard
ProductId:         	RH0958488                
PoolId:            	8a99f9812f270524012f4ab81d401bd7
Quantity:          	93                       
Expires:           	04/11/2012               

[root@jsefler-stage-6workstation ~]# subscription-manager subscribe --pool=8a99f9812f270524012f4ab81d401bd7
[root@jsefler-stage-6workstation ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+

ProductName:        	Red Hat Enterprise Linux Workstation
Status:             	Not Installed            
Expires:            	04/11/2012               
Subscription:       	4188631479613958945      
ContractNumber:     	2280400                  
AccountNumber:      	1444077                  


ProductName:        	Red Hat Enterprise Linux 6 Workstation
Status:             	Not Subscribed           
Expires:            	                         
Subscription:       	                         
ContractNumber:     	                         
AccountNumber:      	                         

[root@jsefler-stage-6workstation ~]# subscription-manager-gui&

Notice in the attached screenshot that the gui reports "Red Hat Enterprise Linux 6 Workstation" as being installed and subscribed, yet the command line tool above shows that the installed product "Red Hat Enterprise Linux 6 Workstation" is "Not Subscribed" while "Red Hat Enterprise Linux Workstation" is covered by the recent bind/subscribe, but is "Not Installed".


I expected the command line tool to produce the following:
[root@jsefler-stage-6workstation ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+

ProductName:        	Red Hat Enterprise Linux 6 Workstation
Status:             	Subscribed            
Expires:            	04/11/2012               
Subscription:       	4188631479613958945      
ContractNumber:     	2280400                  
AccountNumber:      	1444077  




Additional Info:
[root@jsefler-stage-6workstation ~]# openssl x509 -text -in /etc/pki/product/71.pem | grep -A1 1.3.6.1.4.1.2312.9.1
            1.3.6.1.4.1.2312.9.1.71.1: 
                .&Red Hat Enterprise Linux 6 Workstation
            1.3.6.1.4.1.2312.9.1.71.2: 
                ..6.1
            1.3.6.1.4.1.2312.9.1.71.3: 
                ..x86_64
            1.3.6.1.4.1.2312.9.1.71.4: 
                ..rhel-6,rhel-6-workstation
[root@jsefler-stage-6workstation ~]# openssl x509 -text -in /etc/pki/entitlement/4188631479613958945.pem | grep -A1 1.3.6.1.4.1.2312.9.1
            1.3.6.1.4.1.2312.9.1.71.1: 
                .$Red Hat Enterprise Linux Workstation

^^^ As indicated in comment 0, the cli tool should have used the product id "71" to match the entitlement cert with the installed product cert.  Then this bug would be fixed despite the non-equal name values for OID 1.3.6.1.4.1.2312.9.1.71.1

Comment 5 John Sefler 2011-06-02 22:42:27 UTC
FYI, The same failure occurs on 6 Server...

[root@jsefler-stage-6server ~]# subscription-manager register --username=stage_test_28 --autosubscribe
Password: 
c055d06b-ea8d-4cbd-8a57-2979d7b94186 jsefler-stage-6server.usersys.redhat.com
Installed Products:
   Red Hat Enterprise Linux Server - Not Installed
   Red Hat Enterprise Linux 6 Server - Not Subscribed
[root@jsefler-stage-6server ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+

ProductName:        	Red Hat Enterprise Linux Server
Status:             	Not Installed            
Expires:            	05/23/2012               
Subscription:       	341133359893088261       
ContractNumber:     	2280438                  
AccountNumber:      	1444090                  


ProductName:        	Red Hat Enterprise Linux 6 Server
Status:             	Not Subscribed           
Expires:            	                         
Subscription:       	                         
ContractNumber:     	                         
AccountNumber:  

[root@jsefler-stage-6server ~]# openssl x509 -text -in /etc/pki/product/69.pem  | grep -A1 1.3.6.1.4.1.2312.9.1
            1.3.6.1.4.1.2312.9.1.69.1: 
                .!Red Hat Enterprise Linux 6 Server
            1.3.6.1.4.1.2312.9.1.69.2: 
                ..6.1
            1.3.6.1.4.1.2312.9.1.69.3: 
                ..x86_64
            1.3.6.1.4.1.2312.9.1.69.4: 
                ..rhel-6,rhel-6-server
[root@jsefler-stage-6server ~]# openssl x509 -text -in /etc/pki/entitlement/6489788376715987382.pem | grep -A1 1.3.6.1.4.1.2312.9.1
            1.3.6.1.4.1.2312.9.1.69.1: 
                ..Red Hat Enterprise Linux Server

Comment 11 Adrian Likins 2011-06-07 19:31:35 UTC
commit 11aa6649fab0328809918c0b3ce6810258656f10
Author: Adrian Likins <alikins>
Date:   Tue Jun 7 15:23:30 2011 -0400

    709412: cli was using product names for ent cert-> product cert matching
    
    In some cases, this was wrong, so update it to use product ids.
    
    (merge)

Comment 12 John Sefler 2011-06-08 14:39:45 UTC
Verifying Version on a RHEL61 Workstation...
[root@jsefler-stage-6workstation ~]# rpm -qa | grep subscription-manager
subscription-manager-firstboot-0.95.14-1.git.4.11aa664.el6.x86_64
subscription-manager-0.95.14-1.git.4.11aa664.el6.x86_64
subscription-manager-gnome-0.95.14-1.git.4.11aa664.el6.x86_64

[root@jsefler-stage-6workstation ~]# subscription-manager register --username=qa
Password: 
46ed309c-c60c-4474-9374-f258f8b10fd7 jsefler-stage-6workstation.usersys.redhat.com
[root@jsefler-stage-6workstation ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+

ProductName:        	Red Hat Enterprise Linux 6 Workstation
Status:             	Not Subscribed           
Expires:            	                         
Subscription:       	                         
ContractNumber:     	                         
AccountNumber:      	                         

[root@jsefler-stage-6workstation ~]# subscription-manager list --avail | grep -A6 Workstation
ProductName:       	90 day Supported Red Hat Enterprise Linux Workstation
                        Evaluation
ProductId:         	RH0939261                
PoolId:            	8a85f981302cbaf201304b4df59206fe
Quantity:          	99                       
Expires:           	08/29/2011               

[root@jsefler-stage-6workstation ~]# subscription-manager subscribe --pool=8a85f981302cbaf201304b4df59206fe
[root@jsefler-stage-6workstation ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+

ProductName:        	Red Hat Enterprise Linux Workstation
Status:             	Subscribed               
Expires:            	08/29/2011               
Subscription:       	5315563164113430490      
ContractNumber:     	2390960                  
AccountNumber:      	477931                   

[root@jsefler-stage-6workstation ~]# openssl x509 -text -in /etc/pki/product/71.pem | grep -A1 1.3.6.1.4.1.2312.9.1
            1.3.6.1.4.1.2312.9.1.71.1: 
                .&Red Hat Enterprise Linux 6 Workstation
            1.3.6.1.4.1.2312.9.1.71.2: 
                ..6.1
            1.3.6.1.4.1.2312.9.1.71.3: 
                ..x86_64
            1.3.6.1.4.1.2312.9.1.71.4: 
                ..rhel-6,rhel-6-workstation
[root@jsefler-stage-6workstation ~]# openssl x509 -text -in /etc/pki/entitlement/5315563164113430490.pem | grep -A1 1.3.6.1.4.1.2312.9.1
            1.3.6.1.4.1.2312.9.1.71.1: 
                .$Red Hat Enterprise Linux Workstation
[root@jsefler-stage-6workstation ~]# 


^^^ VERIFIED.  Despite the difference in name between the product cert and the entitlement cert ("Red Hat Enterprise Linux 6 Workstation" versus "Red Hat Enterprise Linux Workstation"), the cli call to subscription-manager list --installed now reports that the one workstation product is installed and subscribed.  Also verified in the gui that the one workstation product is installed and subscribed.

Comment 14 Tomas Capek 2011-06-24 08:54:53 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Two variations were used in the ProductName parameter for the workstation subscription: "Red Hat Enterprise Linux Workstation" and "Red Hat Enterprise Linux 6 Workstation". As a consequence, users running the "subscription-manager list --installed" command, while subscribed to the "Red Hat Enterprise Linux Workstation" subscription, got a misleading report. With this update, the ProductId parameter is used instead to compare subscriptions in the described scenario, and the bug no longer occurs.

Comment 19 errata-xmlrpc 2011-12-06 17:14:50 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.

http://rhn.redhat.com/errata/RHBA-2011-1695.html