Bug 623264 - subscription-manager-cli register with --force is not clearing out the consumed product certs
Summary: subscription-manager-cli register with --force is not clearing out the consum...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 0.5
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
: ---
Assignee: Devan Goodwin
QA Contact: John Sefler
URL:
Whiteboard:
Depends On: 641129 641479
Blocks: 636830
TreeView+ depends on / blocked
 
Reported: 2010-08-11 18:16 UTC by John Sefler
Modified: 2015-05-14 15:22 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-11-23 16:14:26 UTC
Embargoed:


Attachments (Terms of Use)

Description John Sefler 2010-08-11 18:16:19 UTC
Description of problem:
I have registered a system consumer and subscribed to all of the available subscription pools until there are "No Available subscription pools to list". At this point list --available is empty and list --consumed is a lot as expected.  Then I register the same system again as the same user with --force.  Now I expect the list --available to be a lot and the list --consumed to be empty.  Actual results are that the list --consumed is not empty.  Instead, list --available is fully populated and the list --consumed is a lot and unchanged.

Version-Release number of selected component (if applicable):
[root@jsefler-rhel6-client01 ~]# rpm -q subscription-manager
subscription-manager-0.74-1.git.26.a2bb368.fc12.i386


Steps to Reproduce:


[root@jsefler-rhel6-client01 ~]# cat /etc/rhsm/rhsm.conf
# Red Hat Subscription Manager Configuration File
# Contents of this file will be overwritten on registration. 

# Remote server Hostname
hostname=candlepin1.devlab.phx1.redhat.com

# Remote Server port
port=443

# Remote base URL
baseurl= http://redhat.com/content

# Directory containing consumer key & certificate 
consumerid = /etc/pki/consumer

# The frequency used to refresh certificates (mins)
certFrequency=1

# Flag to enable Unsupported entitlement pools in GUI
# change this value to 1 to enable this option
showIncompatiblePools = 0
insecure_mode = true
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli register --username=xeops --password=redhat 
2cd3dbb3-95d7-4079-9cb1-18a6faaaf3d3 xeops
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli list --available
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+


ProductName:       	Red Hat Enterprise Linux Advanced Platform, Premium
                        (Unlimited Sockets) w/ 24 x 7 Phone/Web Support
ProductId:         	SYS0373                  
PoolId:            	643                      
Quantity:          	11                       
Expires:           	2011-08-01               


ProductName:       	Red Hat Enterprise Linux Advanced Platform, Standard
                        (Unlimited Sockets)
ProductId:         	SYS0372                  
PoolId:            	644                      
Quantity:          	1                        
Expires:           	2010-12-31               


ProductName:       	JBoss jBPM Framework (for up to 4 CPUs), Premium (w/ 24 x 7
                        Phone/Web Support)
ProductId:         	SYS0415                  
PoolId:            	645                      
Quantity:          	1                        
Expires:           	2012-02-05               


ProductName:       	Red Hat Enterprise Linux Advanced Platform, Standard
                        (Unlimited Sockets)
ProductId:         	SYS0372                  
PoolId:            	646                      
Quantity:          	1                        
Expires:           	2010-12-31               

[root@jsefler-rhel6-client01 ~]# subscription-manager-cli list --consumed
No Consumed subscription pools to list
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli subscribe --pool=643
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli subscribe --pool=644
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli subscribe --pool=645
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli list --consumed
+-------------------------------------------+
    Consumed Product Subscriptions
+-------------------------------------------+


ProductName:        	Red Hat Enterprise Linux Advanced Platform, Premium (Unlimited Sockets) (Legacy SVC0373)
ContractNumber:     	1523750                  
SerialNumber:       	1802                     
Active:             	True                     
Begins:             	2009-02-13               
Expires:            	2011-08-01               


ProductName:        	JBoss jBPM Framework (for up to 4 CPUs), Premium
ContractNumber:     	1525456                  
SerialNumber:       	1804                     
Active:             	True                     
Begins:             	2009-02-06               
Expires:            	2012-02-05               


ProductName:        	Red Hat Enterprise Linux Advanced Platform
ContractNumber:     	1632092                  
SerialNumber:       	1803                     
Active:             	True                     
Begins:             	2010-01-10               
Expires:            	2010-12-31               

[root@jsefler-rhel6-client01 ~]# subscription-manager-cli list --available
No Available subscription pools to list
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli register --username=xeops --password=redhat --force
8ac245dc-ad29-4fa3-b3c1-2b73d4675eaa xeops
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli list --consumed
+-------------------------------------------+
    Consumed Product Subscriptions
+-------------------------------------------+


ProductName:        	Red Hat Enterprise Linux Advanced Platform, Premium (Unlimited Sockets) (Legacy SVC0373)
ContractNumber:     	1523750                  
SerialNumber:       	1802                     
Active:             	True                     
Begins:             	2009-02-13               
Expires:            	2011-08-01               


ProductName:        	JBoss jBPM Framework (for up to 4 CPUs), Premium
ContractNumber:     	1525456                  
SerialNumber:       	1804                     
Active:             	True                     
Begins:             	2009-02-06               
Expires:            	2012-02-05               


ProductName:        	Red Hat Enterprise Linux Advanced Platform
ContractNumber:     	1632092                  
SerialNumber:       	1803                     
Active:             	True                     
Begins:             	2010-01-10               
Expires:            	2010-12-31               

^^^^^^^^^^ AT THIS POINT I WOULD HAVE EXPECTED THE LIST --CONSUMED TO BE EMPTY SINCE THE PIOR STEP WAS A REGISTRATION WITH --FORCE

[root@jsefler-rhel6-client01 ~]# subscription-manager-cli list --available
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+


ProductName:       	Red Hat Enterprise Linux Advanced Platform, Premium
                        (Unlimited Sockets) w/ 24 x 7 Phone/Web Support
ProductId:         	SYS0373                  
PoolId:            	643                      
Quantity:          	11                       
Expires:           	2011-08-01               


ProductName:       	Red Hat Enterprise Linux Advanced Platform, Standard
                        (Unlimited Sockets)
ProductId:         	SYS0372                  
PoolId:            	644                      
Quantity:          	1                        
Expires:           	2010-12-31               


ProductName:       	JBoss jBPM Framework (for up to 4 CPUs), Premium (w/ 24 x 7
                        Phone/Web Support)
ProductId:         	SYS0415                  
PoolId:            	645                      
Quantity:          	1                        
Expires:           	2012-02-05               


ProductName:       	Red Hat Enterprise Linux Advanced Platform, Standard
                        (Unlimited Sockets)
ProductId:         	SYS0372                  
PoolId:            	646                      
Quantity:          	1                        
Expires:           	2010-12-31               

^^^^^^^^^^ AT THIS POINT I DON'T THINK IT MAKES SENSE FOR ALL OF THESE SUBSCRIPTION POOLS TO BE AVAILABLE IF THE PRODUCTS THAT THEY CONTAIN ARE ALREADY CONSUMED AS INDICATED IN THE PRIOR CALL.

[root@jsefler-rhel6-client01 ~]# ls /etc/pki/entitlement/product/
1802.pem  1803.pem  1804.pem

Comment 1 Devan Goodwin 2010-09-21 18:42:09 UTC
Fixed in c4878a0995b76833f827f5635341d77deb69c0ca.

Technically these would get cleaned out the next time rhsmcertd ran which by default could be a few hours.

Discovered forked code here, these would be cleaned up if you unregistered from GUI, or from CLI (both with copies of the same code), but if you were unregistering during register --force this code did not get the same copy of code. Moved all three to call the same logic. Your entitlement certs should get cleared out in each case now.

Comment 2 Jeff Weiss 2010-10-07 20:04:19 UTC
Could not finish the test due to blocking bug. Once that's clear I'll retest.

Comment 3 John Sefler 2010-10-13 21:23:15 UTC
VERIFIED VERSION
[root@jsefler-rhel6-client01 ~]# rpm -q subscription-manager
subscription-manager-0.92-1.el6.x86_64

MAKE SURE THE RHSMCERTD WILL NOT AFFECT THE TEST
[root@jsefler-rhel6-client01 ~]# service rhsmcertd stop
Stopping rhsmcertd                                         [  OK  ]


[root@jsefler-rhel6-client01 ~]# subscription-manager-cli register --username=testuser1 --password=password
29e8c0c6-87f0-44ff-9542-4b4df1b44540 testuser1
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli list --available | grep PoolId
PoolId:            	ff8080812ba6fd48012ba6fe7f5500cd
PoolId:            	ff8080812ba6fd48012ba6fe7fa400d1
PoolId:            	ff8080812ba6fd48012ba6fe7fb400d2
PoolId:            	ff8080812ba6fd48012ba6fe7f9500d0
PoolId:            	ff8080812ba6fd48012ba6fe7ec200cb
PoolId:            	ff8080812ba6fd48012ba6fe7f3400cc
PoolId:            	ff8080812ba6fd48012ba6fe7f7500cf
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli subscribe --pool=ff8080812ba6fd48012ba6fe7f5500cd --pool=ff8080812ba6fd48012ba6fe7fa400d1 --pool=ff8080812ba6fd48012ba6fe7fb400d2 --pool=ff8080812ba6fd48012ba6fe7f9500d0 --pool=ff8080812ba6fd48012ba6fe7ec200cb --pool=ff8080812ba6fd48012ba6fe7f3400cc --pool=ff8080812ba6fd48012ba6fe7f7500cf
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli list --available
No Available subscription pools to list
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli list --consumed | grep SerialNumber
SerialNumber:       	1128700462613410         
SerialNumber:       	1128700462613410         
SerialNumber:       	1128700462613410         
SerialNumber:       	1128700462613410         
SerialNumber:       	1128700462613410         
SerialNumber:       	1128700462613410         
SerialNumber:       	112870046238521          
SerialNumber:       	112870046238521          
SerialNumber:       	112870046238521          
SerialNumber:       	112870046238521          
SerialNumber:       	112870046238521          
SerialNumber:       	112870046238521          
SerialNumber:       	11287004623179196        
SerialNumber:       	11287004623179196        
SerialNumber:       	11287004623179196        
SerialNumber:       	11287004623179196        
SerialNumber:       	11287004623179196        
SerialNumber:       	11287004623179196        
SerialNumber:       	11287004622655235        
SerialNumber:       	11287004625027197        
SerialNumber:       	11287004625027197        
SerialNumber:       	11287004625027197        
SerialNumber:       	11287004625027197        
SerialNumber:       	11287004625027197        
SerialNumber:       	11287004625027197        
SerialNumber:       	1128700462439852         
SerialNumber:       	1128700462439852         
SerialNumber:       	1128700462439852         
SerialNumber:       	1128700462439852         
SerialNumber:       	1128700462439852         
SerialNumber:       	1128700462439852         
SerialNumber:       	1128700462563676               
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli register --username=testuser1 --password=password --force
70c8500d-06e1-44b0-986d-078b6cd72b5a testuser1
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli list --consumed
No Consumed subscription pools to list
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli list --available | grep PoolId
PoolId:            	ff8080812ba6fd48012ba6fe7f9500d0
PoolId:            	ff8080812ba6fd48012ba6fe7ec200cb
PoolId:            	ff8080812ba6fd48012ba6fe7f3400cc
PoolId:            	ff8080812ba6fd48012ba6fe7f7500cf
PoolId:            	ff8080812ba6fd48012ba6fe7f5500cd
PoolId:            	ff8080812ba6fd48012ba6fe7fa400d1
PoolId:            	ff8080812ba6fd48012ba6fe7fb400d2


VERIFIED... THAT A REGISTER WITH FORCE IMMEDIATELY CLEANS OUT THE ENTITLEMENT CERTS

Comment 4 John Sefler 2010-11-23 16:14:26 UTC
This bug was opened/resolved/closed against the Entitlement-Alpha release.


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