Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 852630

Summary: subscription-manager unsubscribe -all on expired subscriptions says "[Errno 2] No such file or directory: '/etc/pki/entitlement/1364069144416875315.pem'"
Product: Red Hat Enterprise Linux 5 Reporter: Shwetha Kallesh <skallesh>
Component: subscription-managerAssignee: Devan Goodwin <dgoodwin>
Status: CLOSED ERRATA QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.9CC: bkearney, dgoodwin, jmolet, jsefler, skallesh, 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: 2013-01-08 04:01:20 UTC Type: Bug
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: 771748    

Description Shwetha Kallesh 2012-08-29 07:33:23 UTC
Description of problem:
subscription-manager unsubscribe -all on expired subscriptions says "[Errno 2] No such file or directory: '/etc/pki/entitlement/1364069144416875315.pem'"

Version-Release number of selected component (if applicable):
[root@dhcp201-115 ~]# rpm -qa | grep subscription-manager
subscription-manager-migration-1.0.14-1.git.27.c389edc.el5
subscription-manager-gui-1.0.14-1.git.27.c389edc.el5
subscription-manager-1.0.14-1.git.27.c389edc.el5
subscription-manager-migration-data-1.11.2.3-1.git.4.8bd27be.el5
subscription-manager-firstboot-1.0.14-1.git.27.c389edc.el5


How reproducible:


Steps to Reproduce:
[root@dhcp201-115 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+

Subscription Name:    	Awesome OS Modifier
Provides:             	Awesome OS Modifier Bits
SKU:                  	awesomeos-modifier
Contract:             	1
Account:              	12331131231
Serial Number:        	6972667992922968976
Active:               	True
Quantity Used:        	1
Service Level:        	
Service Type:         	
Starts:               	08/29/2012
Ends:                 	08/29/2013

Subscription Name:    	Awesome OS for x86_64
Provides:             	Awesome OS for x86_64 Bits
SKU:                  	awesomeos-x86_64
Contract:             	67
Account:              	12331131231
Serial Number:        	8965114954999863048
Active:               	True
Quantity Used:        	1
Service Level:        	
Service Type:         	
Starts:               	08/29/2012
Ends:                 	08/29/2013

Subscription Name:    	Stackable with Awesome OS for x86_64
Provides:             	Stackable with Awesome OS for x86_64 Bits
SKU:                  	stackable-with-awesomeos-x86_64
Contract:             	73
Account:              	12331131231
Serial Number:        	6041817958596057409
Active:               	True
Quantity Used:        	1
Service Level:        	
Service Type:         	
Starts:               	08/29/2012
Ends:                 	08/29/2013

Subscription Name:    	Awesome OS for x86_64/i686/ia64/ppc/ppc64/s390x/s390
Provides:             	Awesome OS for x86_64/i686/ia64/ppc/ppc64/s390x/s390 Bits
SKU:                  	awesomeos-everything
Contract:             	97
Account:              	12331131231
Serial Number:        	5221125106532114368
Active:               	True
Quantity Used:        	1
Service Level:        	
Service Type:         	
Starts:               	08/29/2012
Ends:                 	08/29/2013

Subscription Name:    	Awesome OS for x86_64
Provides:             	
SKU:                  	awesomeos-x86_64
Contract:             	1100715396
Account:              	1596598371
Serial Number:        	4451927680509515130
Active:               	True
Quantity Used:        	1
Service Level:        	
Service Type:         	
Starts:               	08/28/2012
Ends:                 	08/29/2012
                         ^^ product will expire in 3 mins
[root@dhcp201-115 ~]# date
Wed Aug 29 12:53:32 IST 2012

2.after 3 mins if I do a unsubscribe all

[root@dhcp201-115 ~]# date
Wed Aug 29 12:58:59 IST 2012
[root@dhcp201-115 ~]# subscription-manager unsubscribe --all
This machine has been unsubscribed from 5 subscriptions
[Errno 2] No such file or directory: '/etc/pki/entitlement/2346952424293290259.pem'

3.
  
Actual results:


Expected results:


Additional info:

Comment 1 RHEL Program Management 2012-08-29 12:07:45 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 2 William Poteat 2012-10-09 12:11:51 UTC
Master commit b82aecd2bdd542a870a9b978ec33d85d40434785

Comment 5 Shwetha Kallesh 2012-10-12 06:33:42 UTC
Moving back to new 

[root@localhost pki]# subscription-manager version
registered to: 0.7.13-1
server type: subscription management service
subscription-manager: 1.0.22-1.git.0.1bda3f4.el5
python-rhsm: 1.0.10-1.git.0.76d7802.el5



[root@localhost pki]# subscription-manager import --certificate=/root/Expiredcert.pem 
Successfully imported certificate Expiredcert.pem

[root@localhost entitlement]# ll
total 16
-rw-r--r-- 1 root root 1674 Oct 12 11:18 1845482705944796227-key.pem
-rw-r--r-- 1 root root 1796 Oct 12 11:18 1845482705944796227.pem

[root@localhost pki]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
------------------------------------------+

Product Name:         	Shared Storage Bits
Product ID:           	37067
Version:              	1.0
Arch:                 	ALL
Status:               	Not Subscribed
Starts:               	
Ends:                 	


Product Name:         	Awesome OS for i686 Bits
Product ID:           	100000000000005
Version:              	3.11
Arch:                 	i686
Status:               	Not Subscribed
Starts:               	
Ends:                 	
               	

Product Name:         	Shared File System Bits
Product ID:           	88888
Version:              	1.0
Arch:                 	ALL
Status:               	Expired
Starts:               	
Ends:                 	


[root@localhost pki]# subscription-manager unsubscribe --all
[Errno 2] No such file or directory: '/etc/pki/entitlement/1845482705944796227.pem'


[root@localhost pki]# rct cat-cert /root/Expiredcert.pem 

+-------------------------------------------+
	Entitlement Certificate
+-------------------------------------------+

Certificate:
	Path: /root/Expiredcert.pem
	Version: 1.0
	Serial: 1845482705944796227
	Start Date: 2011-10-08 00:00:00+00:00
	End Date: 2012-10-07 00:00:00+00:00

Comment 6 Shwetha Kallesh 2012-10-12 06:41:39 UTC
Marking Verified

Sorry verified on wrong version of subscription-manager

[root@localhost ~]# subscription-manager version
registered to: Unknown
server type: subscription management service
subscription-manager: 1.0.21-1.el5
python-rhsm: 1.0.9-1.el5


[root@localhost ~]# subscription-manager import --certificate=/root/Expiredcert.pem 
Successfully imported certificate Expiredcert.pem
[root@localhost ~]# ls /etc/pki/entitlement/
1845482705944796227-key.pem  1845482705944796227.pem
[root@localhost ~]# subscription-manager unsubscribe --all
This machine has been unsubscribed from 1 subscriptions

Comment 7 Devan Goodwin 2012-10-16 15:50:59 UTC
Sorry guys, fix was bad, we had to pull it out and re-do as it caused bug #865590, and bug #865423 is a duplicate that would have remain unfixed.

Fixed in subscription-manager.git 6b65e3d082c19f5ea555aa5e2beb7bb4d47b114f.

Comment 8 Devan Goodwin 2012-10-16 15:51:46 UTC
*** Bug 865423 has been marked as a duplicate of this bug. ***

Comment 10 John Sefler 2012-10-19 17:26:48 UTC
Verifying version...
[root@jsefler-rhel59 ~]# rpm -q subscription-manager python-rhsm
subscription-manager-1.0.23-1.el5
python-rhsm-1.0.10-1.el5


[root@jsefler-rhel59 ~]# ls /etc/pki/entitlement/
[root@jsefler-rhel59 ~]# subscription-manager import --certificate /tmp/Expiredcert.pem 
Successfully imported certificate Expiredcert.pem
[root@jsefler-rhel59 ~]# ls /etc/pki/entitlement/
1845482705944796227-key.pem  1845482705944796227.pem
[root@jsefler-rhel59 ~]# subscription-manager list --consumed
No consumed subscription pools to list
^^ NOTICE THAT EXPIRED ENTITLEMENTS ARE NOT CONSUMED (FOOD FOR THOUGHT) ^^
[root@jsefler-rhel59 ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:         	Shared File System Bits
Product ID:           	88888
Version:              	1.0
Arch:                 	ALL
Status:               	Expired
Starts:               	
Ends:                 	

[root@jsefler-rhel59 ~]# 
[root@jsefler-rhel59 ~]# subscription-manager unsubscribe --all
This machine has been unsubscribed from 1 subscriptions
[root@jsefler-rhel59 ~]# ls /etc/pki/entitlement/
[root@jsefler-rhel59 ~]# subscription-manager list --consumed
No consumed subscription pools to list
[root@jsefler-rhel59 ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:         	Shared File System Bits
Product ID:           	88888
Version:              	1.0
Arch:                 	ALL
Status:               	Not Subscribed
Starts:               	
Ends: 


Moving to VERIFIED

Comment 12 errata-xmlrpc 2013-01-08 04:01:20 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-2013-0033.html