Bug 853876

Summary: After deletion of consumer,subscription-manager --register --force says "Consumer <ConsumerID> has been deleted"
Product: Red Hat Enterprise Linux 5 Reporter: Shwetha Kallesh <skallesh>
Component: subscription-managerAssignee: Michael Stead <mstead>
Status: CLOSED ERRATA QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.9CC: alikins, awood, bkearney, jsefler, mstead, ndong, skallesh
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: When a consumer has been deleted on redhat.com's subscription management application. Consequence: The client is left in an inconsistent state with old consumer and entitlement certificates that are no longer valid. Fix: Result: Now the rhsmcert daemon recognizes this inconsistent state, cleans the old entitlements, makes a backup of the old consumer certificate, and allows the client to register with --force.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-08 04:02:49 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-09-03 08:09:44 UTC
Description of problem:
After deletion of consumer,subscription-manager --register --force says "Consumer <ConsumerID> has been deleted

Version-Release number of selected component (if applicable):
[root@dhcp201-115 pki]# rpm -qa | grep subscription-manager
subscription-manager-1.0.17-1.el5
subscription-manager-firstboot-1.0.17-1.el5
subscription-manager-debuginfo-1.0.17-1.el5
subscription-manager-gui-1.0.17-1.el5
subscription-manager-migration-1.0.17-1.el5

How reproducible:


Steps to Reproduce:
1.[root@dhcp201-115 pki]# curl --stderr /dev/null --insecure --user admin:admin --request DELETE https://10.65.201.132:8443/candlepin/consumers/9d26b78c-cc71-4fba-a584-c9969db32b3f


[root@dhcp201-115 pki]# subscription-manager register --force --org=admin
Consumer 9d26b78c-cc71-4fba-a584-c9969db32b3f has been deleted

2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Adrian Likins 2012-09-21 20:38:14 UTC
This is correct behaviour. The client attempts to unregister before a new force register, and if that system has been deleted (a 410 response indicating that that consumer did exist, but has already been deleted), it will show that warning.

Comment 2 John Sefler 2012-09-24 13:59:46 UTC
[root@jsefler-rhel59 ~]# rpm -q subscription-manager python-rhsm
subscription-manager-1.0.19-1.git.11.b6e84e6.el5
python-rhsm-1.0.8-1.git.1.b3f4b2c.el5


[root@jsefler-rhel59 ~]# subscription-manager version
Consumer 26e9344a-2f27-4098-a0f2-f6a3e4b3f7b7 has been deleted
[root@jsefler-rhel59 ~]# subscription-manager list --installed
Consumer 26e9344a-2f27-4098-a0f2-f6a3e4b3f7b7 has been deleted
[root@jsefler-rhel59 ~]# subscription-manager list --consumed
Consumer 26e9344a-2f27-4098-a0f2-f6a3e4b3f7b7 has been deleted
[root@jsefler-rhel59 ~]# subscription-manager facts --list
Consumer 26e9344a-2f27-4098-a0f2-f6a3e4b3f7b7 has been deleted
[root@jsefler-rhel59 ~]# subscription-manager service-level
Consumer 26e9344a-2f27-4098-a0f2-f6a3e4b3f7b7 has been deleted
[root@jsefler-rhel59 ~]# subscription-manager release
Consumer 26e9344a-2f27-4098-a0f2-f6a3e4b3f7b7 has been deleted
[root@jsefler-rhel59 ~]# subscription-manager repos --list
Consumer 26e9344a-2f27-4098-a0f2-f6a3e4b3f7b7 has been deleted
[root@jsefler-rhel59 ~]# subscription-manager unregister
Consumer 26e9344a-2f27-4098-a0f2-f6a3e4b3f7b7 has been deleted

[root@jsefler-rhel59 ~]# subscription-manager clean
All local data removed

^^^ AFTER A SERVER-SIDE DELETION, I CAN'T SEEM TO DO ANYTHING ON THE CLIENT EXCEPT CLEAN.  MOST ALL OF THE COMMANDS ABOVE SHOULD NOT CARE THAT THE CONSUMER WAS DELETED SERVER SIDE.

Comment 3 Michael Stead 2012-09-24 14:03:06 UTC
I do not agree with comment 1.

This is not a warning... This is a hard and fast failure preventing the user from re-registering with the --force option. This is a result of a GoneException that is being thrown when the command checks candlepin's status which stops execution. This is not happing during an unregister attempt.

IMO, I think that --force should allow the user to re-register. Isn't that its intent.

Comment 4 John Sefler 2012-09-24 14:27:44 UTC
(In reply to comment #3)
> I actually agree with both comment 1 and comment 3.  If you can catch the GoneException when a user tries to register with force, and then inject a subscription-manager clean and resume the register, then I think the user would get the behavior they desired.  But don't forget to copy the consumer dir to /etc/pki/consumer.old/  (that was one of the requested requirements that wpoteat implemented a while back).

Comment 5 Michael Stead 2012-09-24 16:38:18 UTC
It is the job of rhsmcertd to do this backup (copy) since it is the only place that _automatically_ deletes the consumer cert on the client (without user's awareness).

When doing a --force, the user is fully aware of what they are doing. Is there really a need to do the backup? We don't do a backup when we do a standard clean from the CLI.

Comment 6 RHEL Program Management 2012-09-25 14:08:00 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 7 Michael Stead 2012-09-25 14:11:27 UTC
Fixed in:
master - c5e879887731e7e4721cc460079c345648d99b32
inernal - b749cadd02ea7dc924d160cf9d161ac20b0821fd

Comment 9 Adrian Likins 2012-09-26 17:39:15 UTC
*** Bug 859811 has been marked as a duplicate of this bug. ***

Comment 10 Shwetha Kallesh 2012-09-27 04:25:46 UTC
Marking verified!!

[root@localhost ~]# rpm -qa | grep subscription-manager
subscription-manager-debuginfo-1.0.20-1.el5
subscription-manager-migration-data-1.11.2.4-1.el5
subscription-manager-1.0.20-1.el5
subscription-manager-migration-1.0.20-1.el5
subscription-manager-firstboot-1.0.20-1.el5
subscription-manager-gui-1.0.20-1.el5


[root@localhost ~]# subscription-manager register --org=admin
Username: admin
Password: 

[root@localhost ~]# curl --stderr /dev/null --insecure --user admin:admin --request DELETE https://10.70.35.91:8443/candlepin/consumers/7dc4dc9a-b146-410d-9d92-51b3fc049309
[root@localhost ~]# subscription-manager register --force --org=admin
Username: admin
Password: 
The system has been registered with id: fc4d3e7a-362f-4929-a980-cae5505fd155

Comment 12 errata-xmlrpc 2013-01-08 04:02:49 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