Bug 739671

Summary: system.entitlements_valid reports True when system is only partially subscribed
Product: Red Hat Enterprise Linux 5 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Bryan Kearney <bkearney>
Status: CLOSED DUPLICATE QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 5.7CC: dgoodwin, skallesh, spandey
Target Milestone: beta   
Target Release: 5.8   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-11-07 16:33:42 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: 715031    
Attachments:
Description Flags
Even though the overall system entitlement certificate status is yellow, the system.entitlements_valid fact is reported as True none

Description John Sefler 2011-09-19 18:50:14 UTC
Created attachment 523887 [details]
Even though the overall system entitlement certificate status is yellow,  the system.entitlements_valid fact is reported as True

Description of problem:
When your system is partially subscribed such that your overall system certificate status is yellow, the fact value for system.entitlements_valid is currently reported as True.  The popular vote for this case is to report system.entitlements_valid as False.

In other words, system.entitlements_valid should be False when there is any red and/or yellow installed product.

On the other hand, it has been suggested that fact system.entitlements_valid should no longer be a boolean value (True or False).  It may be more appropriate to change it to a status like this: 
  system.entitlements_status: {Red, Yellow, or Green}

This would better parallel the information displayed in the GUI.

Version-Release number of selected component (if applicable):
[root@jsefler-onprem-62server ~]# rpm -q subscription-manager
subscription-manager-0.96.9-1.git.17.e75f4f4.el6.x86_64


How reproducible:


Steps to Reproduce:
Using a candlepin server with TESTDATA=1 deployed, install one of the product certs corresponding to a stackable subscription (100000000000002.pem).
register and subscribe with a quantity of 1 on a machine with greater than 1 sockets.

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

ProductName:        	Awesome OS for x86_64 Bits
Status:             	Partially Subscribed     
Expires:            	09/17/2012               
SerialNumber:       	6345407863697003408      
ContractNumber:     	31                       
AccountNumber:      	12331131231              

[root@jsefler-onprem-62server ~]# subscription-manager facts --list | grep entitlements_valid
system.entitlements_valid: True

                           ^^^^
I EXPECTED THAT VALUE TO BE False GIVEN THAT THE OVERALL SYSTEM CERTIFICATE STATUS IS NOT GREEN (see attachment).

Comment 3 Devan Goodwin 2011-11-07 16:33:42 UTC

*** This bug has been marked as a duplicate of bug 740377 ***

Comment 4 John Sefler 2011-12-12 20:38:02 UTC
Verifying Version...
[root@jsefler-onprem-5server ~]# rpm -q subscription-manager
subscription-manager-0.98.7-1.el5


[root@jsefler-onprem-5server ~]# subscription-manager facts --list | grep cpu_socket
cpu.cpu_socket(s): 2
[root@jsefler-onprem-5server ~]# ls /etc/pki/product/
100000000000002.pem


[root@jsefler-onprem-5server ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
ProductName:          	Awesome OS for x86_64 Bits
Version:              	3.11                     
Arch:                 	x86_64                   
Status:               	Not Subscribed           
Starts:               	None                     
Expires:              	None                     

[root@jsefler-onprem-5server ~]# subscription-manager facts --list | grep entitlements_valid
system.entitlements_valid: invalid

^^^ STARTING POINT: Before subscribing for coverage of my installed product, the overall system compliance is invalid.

[root@jsefler-onprem-5server ~]# subscription-manager register --username testuser1 --password password --org admin
The system has been registered with id: 3fabe006-ec08-40b6-b1da-ab2e4248a644 
[root@jsefler-onprem-5server ~]# subscription-manager list --avail | grep awesomeos-x86_64 -A5 -B1 | grep Yes -B4 -A2
ProductName:          	Awesome OS for x86_64    
ProductId:            	awesomeos-x86_64         
PoolId:               	8a90f857342fcd1501342fce188202f9
Quantity:             	10                       
Multi-Entitlement:    	Yes                      
Expires:              	01/09/2013               
MachineType:          	physical                 
--
ProductName:          	Awesome OS for x86_64    
ProductId:            	awesomeos-x86_64         
PoolId:               	8a90f857342fcd1501342fce18990304
Quantity:             	5                        
Multi-Entitlement:    	Yes                      
Expires:              	01/09/2013               
MachineType:          	physical                 
[root@jsefler-onprem-5server ~]# subscription-manager subscribe --pool 8a90f857342fcd1501342fce188202f9 --quantity 1
Successfully consumed a subscription from the pool with id 8a90f857342fcd1501342fce188202f9
[root@jsefler-onprem-5server ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
ProductName:          	Awesome OS for x86_64 Bits
Version:              	3.11                     
Arch:                 	x86_64                   
Status:               	Partially Subscribed     
Starts:               	11/10/2011               
Expires:              	01/09/2013               

[root@jsefler-onprem-5server ~]# subscription-manager facts --list | grep entitlements_valid
system.entitlements_valid: partial
[root@jsefler-onprem-5server ~]# 


^^^ VERIFIED Both the list --installed and the system.entitlements_valid fact are in agreement when partially subscribed using multi-entitlement subscription that provides 1 socket coverage against a 2 socket system.


Now let's complete the test by subscribing to one more quantity from the same pool to achieve compliance...


[root@jsefler-onprem-5server ~]# subscription-manager subscribe --pool 8a90f857342fcd1501342fce188202f9 --quantity 1
Successfully consumed a subscription from the pool with id 8a90f857342fcd1501342fce188202f9
[root@jsefler-onprem-5server ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
ProductName:          	Awesome OS for x86_64 Bits
Version:              	3.11                     
Arch:                 	x86_64                   
Status:               	Subscribed               
Starts:               	11/10/2011               
Expires:              	01/09/2013               

[root@jsefler-onprem-5server ~]# subscription-manager facts --list | grep entitlements_valid
system.entitlements_valid: valid
[root@jsefler-onprem-5server ~]# 

^^^ SUCCESS.  The entitlements_valid fact now follows the overall system compliance for all three states: invalid, partial, and valid.


VERIFIED