Bug 736424

Summary: CLI function "subscription-manager list --installed" reports TOO much information
Product: Red Hat Enterprise Linux 6 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Bryan Kearney <bkearney>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2CC: alikins, bkearney, lzap, skallesh, spandey, 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: 2011-12-06 17:24:06 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: 682238, 743047    

Description John Sefler 2011-09-07 16:33:56 UTC
Description of problem:
This complaint about the CLI function "subscription-manager list --installed" has been a long time coming.  Now with the introduction of stacking, I've been tipped over the edge.  Here's the problem:  list --installed currently displays a "join" of the product certs and the entitlement certs and labels each with a status of {"Installed", "Not Installed", "Subscribed", "Not Subscribed", "Partially Subscribed"}.  It is not intuitive by the function name (list --installed) why the list shows more information than the products that are simply installed.

I believe the list --installed should do the following...

1. list one entry per product cert located in /etc/pki/product
2. display a "ProductName" that comes from the product namespace in the product cert in /etc/pki/product (not the ordernamespace of a covering entitlement cert)
3. display a "Status" which is one of {"Not Subscribed", "Partially Subscribed", Subscribed"}.  Effectively the status is determined by a roll-up of all the covering entitlements to determine this value.
4. display an "End Date" which is the first day the status will change to "Not Subscribed".  Also determined by a roll-up of all the covering entitlements.
5. display the "Version" because it is part of the product cert and also displayed by the GUI
6. display the "Arch" because it is part of the product cert and also displayed by the GUI

It would look something like this:

# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+

ProductName:            Red Hat Enterprise Linux 6 Server
Version:                6.1
Arch:                   x86_64
Status:                 Partially Subscribed           
End Date:               06/16/2012



I believe this proposal would bring the CLI behavior closer to the behavior of "My Installed Software" in the GUI.



Additional info:
Changing this behavior may help address and certainly impact all these bugs:
Bug 733327 - stacking entitlements reports as distinct entries in cli list --installed
Bug 734880 - subscription-manager list --installed reports differently between LEGACY vs NEW SKU subscriptions
Bug 733805 - the name in the subscription-manager installed product listing is changing after a valid subscribe is performed
Bug 734990 - list --installed gives confusing output after subscribing RHEL for SAP

Comment 1 John Sefler 2011-09-07 19:40:25 UTC
I neglected to list a Start Date...

7. display a "Start Date" which shows the first date of the rolled up entitlements that cover this product (at either yellow or green level).  If the status of the product is "Not Subscribed" today, then the start date should reflect the next future date that an entitlement covers this product and the "Status" should be "Future Subscription" just like the gui.

Comment 2 John Sefler 2011-09-08 14:00:30 UTC
Here's a past customer bug impacted if we change the behavior of list --installed:
Bug 709412 - subscription manager cli uses product name comparisons in the list command

Comment 3 Adrian Likins 2011-09-20 18:14:20 UTC
(master)
commit 7970d88e5b35d47617a8d31d306cbbafead59cef
Author: Adrian Likins <alikins>
Date:   Thu Sep 8 14:52:31 2011 -0400

    736424: list --installed only shows installed products
    
    list --installed should now only shows installed
    products, and shows a more concise and accurate set
    of date about those products
    
    add cert_sorter. get_status to get the entitlement status for a product id
    
    update the output format of list --installed as well.
    
    Add get_end_date to cert_sorter to figure out end date for a
    product (probably needs more of the find_first_invalid_product
    logic in there)

Comment 4 Bryan Kearney 2011-09-22 17:51:19 UTC
*** Bug 738593 has been marked as a duplicate of this bug. ***

Comment 5 John Sefler 2011-09-26 17:48:56 UTC
Verifying Version...
[root@jsefler-onprem-62server ~]# rpm -q subscription-manager
subscription-manager-0.96.11-1.git.9.b453a83.el6.x86_64


[root@jsefler-onprem-62server ~]# subscription-manager register --username stage_test_12
Password: 
The system has been registered with id: 1765b561-5698-442b-9641-10ec3f63491f 
[root@jsefler-onprem-62server ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+

ProductName:        	Red Hat Enterprise Linux Server
Version:            	6.2 Beta                 
Arch:               	x86_64                   
Status:             	Not Subscribed           
Starts:             	                         
Expires:            	                         

[root@jsefler-onprem-62server ~]# 

^^^ NOTICE ONLY ONE PRODUCT IS INSTALLED

[root@jsefler-onprem-62server ~]# subscription-manager list --avail
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+


ProductName:       	Red Hat Enterprise Linux Server, Premium (8 sockets) (Up to
                        4 guests)
ProductId:         	RH0103708                
PoolId:            	8a99f981308acf4201308b9ad4a41d37
Quantity:          	93                       
Multi-Entitlement: 	No                       
Expires:           	06/08/2012               
MachineType:       	physical                 


ProductName:       	Red Hat Enterprise Linux Server, Premium (8 sockets) (Up to
                        4 guests)
ProductId:         	RH0103708                
PoolId:            	8a99f981308acf4201308b9ad7101d3a
Quantity:          	395                      
Multi-Entitlement: 	No                       
Expires:           	06/08/2012               
MachineType:       	virtual                  


ProductName:       	Red Hat Enterprise Linux Advanced Platform, Standard L3
                        (unlimited sockets)
ProductId:         	MCT1035                  
PoolId:            	8a99f981308acf4201309911639a0c51
Quantity:          	98                       
Multi-Entitlement: 	No                       
Expires:           	06/15/2012               
MachineType:       	physical                 


ProductName:       	Red Hat Enterprise Linux Advanced Platform, Standard L3
                        (unlimited sockets)
ProductId:         	MCT1035                  
PoolId:            	8a99f981308acf420130991163ac0c56
Quantity:          	unlimited                
Multi-Entitlement: 	No                       
Expires:           	06/15/2012               
MachineType:       	virtual                  

[root@jsefler-onprem-62server ~]# subscription-manager subscribe --pool 8a99f981308acf420130991163ac0c56 --pool 8a99f981308acf4201309911639a0c51 --pool 8a99f981308acf4201308b9ad7101d3a --pool 8a99f981308acf4201308b9ad4a41d37
Successfully subscribed the system to Pool 8a99f981308acf420130991163ac0c56
Successfully subscribed the system to Pool 8a99f981308acf4201309911639a0c51
Successfully subscribed the system to Pool 8a99f981308acf4201308b9ad7101d3a
Successfully subscribed the system to Pool 8a99f981308acf4201308b9ad4a41d37
[root@jsefler-onprem-62server ~]# subscription-manager list --consumed
+-------------------------------------------+
    Consumed Product Subscriptions
+-------------------------------------------+


ProductName:        	Red Hat Enterprise Linux Resilient Storage (for RHEL Server)
ContractNumber:     	2394396                  
AccountNumber:      	1465502                  
SerialNumber:       	3238052424888783772      
Active:             	True                     
QuantityUsed:       	1                        
Begins:             	06/16/2011               
Expires:            	06/15/2012               


ProductName:        	Red Hat Enterprise Linux Load Balancer (for RHEL Server)
ContractNumber:     	2394396                  
AccountNumber:      	1465502                  
SerialNumber:       	3238052424888783772      
Active:             	True                     
QuantityUsed:       	1                        
Begins:             	06/16/2011               
Expires:            	06/15/2012               


ProductName:        	Red Hat Enterprise Linux High Availability (for RHEL Server)
ContractNumber:     	2394396                  
AccountNumber:      	1465502                  
SerialNumber:       	3238052424888783772      
Active:             	True                     
QuantityUsed:       	1                        
Begins:             	06/16/2011               
Expires:            	06/15/2012               


ProductName:        	Red Hat Enterprise Linux Server
ContractNumber:     	2394396                  
AccountNumber:      	1465502                  
SerialNumber:       	3238052424888783772      
Active:             	True                     
QuantityUsed:       	1                        
Begins:             	06/16/2011               
Expires:            	06/15/2012               


ProductName:        	Red Hat Enterprise Linux Resilient Storage (for RHEL Server)
ContractNumber:     	2394396                  
AccountNumber:      	1465502                  
SerialNumber:       	6791263724907722222      
Active:             	True                     
QuantityUsed:       	1                        
Begins:             	06/16/2011               
Expires:            	06/15/2012               


ProductName:        	Red Hat Enterprise Linux Load Balancer (for RHEL Server)
ContractNumber:     	2394396                  
AccountNumber:      	1465502                  
SerialNumber:       	6791263724907722222      
Active:             	True                     
QuantityUsed:       	1                        
Begins:             	06/16/2011               
Expires:            	06/15/2012               


ProductName:        	Red Hat Enterprise Linux High Availability (for RHEL Server)
ContractNumber:     	2394396                  
AccountNumber:      	1465502                  
SerialNumber:       	6791263724907722222      
Active:             	True                     
QuantityUsed:       	1                        
Begins:             	06/16/2011               
Expires:            	06/15/2012               


ProductName:        	Red Hat Enterprise Linux Server
ContractNumber:     	2394396                  
AccountNumber:      	1465502                  
SerialNumber:       	6791263724907722222      
Active:             	True                     
QuantityUsed:       	1                        
Begins:             	06/16/2011               
Expires:            	06/15/2012               


ProductName:        	Red Hat Enterprise Linux Server
ContractNumber:     	2394344                  
AccountNumber:      	1465502                  
SerialNumber:       	1580071410228035058      
Active:             	True                     
QuantityUsed:       	1                        
Begins:             	06/09/2011               
Expires:            	06/08/2012               


ProductName:        	Red Hat Enterprise Linux Server
ContractNumber:     	2394344                  
AccountNumber:      	1465502                  
SerialNumber:       	5098874643832152470      
Active:             	True                     
QuantityUsed:       	1                        
Begins:             	06/09/2011               
Expires:            	06/08/2012               

[root@jsefler-onprem-62server ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+

ProductName:        	Red Hat Enterprise Linux Server
Version:            	6.2 Beta                 
Arch:               	x86_64                   
Status:             	Subscribed               
Starts:             	06/09/2011               
Expires:            	06/08/2012               

[root@jsefler-onprem-62server ~]#

^^^ VERIFIED
Although we have subscribed to many pools and received multiple entitlements for the installed product, now only one report for the product shows in the list --installed.
The issue we now face is what the proper rolled up status and dates should be reported for the installed product.  This issue has been opened as a separate bug 741155.

Comment 6 errata-xmlrpc 2011-12-06 17:24:06 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