Bug 735338

Summary: subscription-manager CLI tool does not allow unsubscribe when not registered
Product: Red Hat Enterprise Linux 6 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: William Poteat <wpoteat>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2CC: jmolet, 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:02 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-02 12:11:39 UTC
Description of problem:
In the user scenario where the system is running disconnected and they have imported an entitlement certificate, the cli tool does not allow them to unsubscribe.  The command is blocked with a "you need to register before" using this command.  This scenario was fixed for the gui tool in bug 723363, but not the cli tool.

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


How reproducible:


Steps to Reproduce:
[root@jsefler-onprem-62server ~]# subscription-manager identity
Consumer not registered. Please register using --username and --password
[root@jsefler-onprem-62server ~]# subscription-manager import --certificate=/tmp/sm-importCertificatesDir/5614217831278296352.pem 
Successfully imported certificate 5614217831278296352.pem
[root@jsefler-onprem-62server ~]# subscription-manager list --consumed
+-------------------------------------------+
    Consumed Product Subscriptions
+-------------------------------------------+


ProductName:        	Awesome OS Server Bits   
ContractNumber:     	66                       
AccountNumber:      	12331131231              
SerialNumber:       	5614217831278296352      
Active:             	True                     
QuantityUsed:       	1                        
Begins:             	05/29/2011               
Expires:            	10/28/2012               

[root@jsefler-onprem-62server ~]# subscription-manager unsubscribe --serial=5614217831278296352
Error: You need to register this system by running `register` command before using this option.

^^^ BANG! A client who has just successfully imported an entitlement cert cannot revert his action and unsubscribe using the subscription-manager cli tool.

Comment 3 William Poteat 2011-09-12 12:11:22 UTC
commit c5843112b4e6a221c1eb95a3abdc800d805324d1
Author: William Poteat <wpoteat>
Date:   Wed Sep 7 08:49:22 2011 -0400

    735338: Subscription Manager CLI tool does not allow unsubscribe when not registered.
    
    735212: Subscription-manager import help should use singular CERTIFICATE-FILE

Comment 4 John Sefler 2011-09-13 18:51:37 UTC
Verifying Version...
[root@jsefler-onprem-62server ~]# rpm -q subscription-manager
subscription-manager-0.96.9-1.git.10.adab5e3.el6.x86_64
[root@jsefler-onprem-62server ~]# rpm -q python-rhsm
python-rhsm-0.96.11-1.git.8.7061b8a.el6.noarch


[root@jsefler-onprem-62server ~]# subscription-manager clean
All local data removed
[root@jsefler-onprem-62server ~]# subscription-manager import --certificate=/tmp/sm-importCertificatesDir/9196177807768642459.pem
Successfully imported certificate 9196177807768642459.pem
[root@jsefler-onprem-62server ~]# subscription-manager list --consumed
+-------------------------------------------+
    Consumed Product Subscriptions
+-------------------------------------------+


ProductName:        	Awesome OS for i686/x86_64 Bits
ContractNumber:     	45                       
AccountNumber:      	12331131231              
SerialNumber:       	9196177807768642459      
Active:             	True                     
QuantityUsed:       	1                        
Begins:             	09/11/2011               
Expires:            	09/10/2012               

[root@jsefler-onprem-62server ~]# subscription-manager identity
Consumer not registered. Please register using --username and --password
[root@jsefler-onprem-62server ~]# subscription-manager unsubscribe --serial=9196177807768642459
This machine has been unsubscribed from subscription with serial number 9196177807768642459
[root@jsefler-onprem-62server ~]# subscription-manager list --consumed
No Consumed subscription pools to list
[root@jsefler-onprem-62server ~]# 


^^^ VERIFIED that an unregistered client can unsubscribe from an imported entitlement cert.

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