Bug #15336
closedOrg/Location removal results in a ISE
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1343108
Description of problem:
The organization removal task is not atomic:
If the organization has some managed resources associated, its removal will fail:
# hammer -u admin -p changeme organization delete --id 3 [............ ] [95%] foo is being used by a hidden Host::Managed resource However, Candlepin manages to remove the Owner: [candlepin.log - hashes truncated] 2016-06-06 09:34:43,813 [thread=http-8443-2] [req=83f71be1, org=] INFO org.candlepin.common.filter.LoggingFilter - Request: verb=DELETE, uri=/candlepin/owners/foo 2016-06-06 09:34:43,831 [thread=http-8443-2] [req=83f71be1, org=] INFO org.candlepin.resource.OwnerResource - Cleaning up owner: Owner [id: 8a90c0b855, key: foo] 2016-06-06 09:34:43,890 [thread=http-8443-2] [req=83f71be1, org=] INFO org.candlepin.resource.OwnerResource - Deleting owner: Owner [id: 8a90c0b855, key: foo] 2016-06-06 09:34:43,897 [thread=http-8443-2] [req=83f71be1, org=] INFO org.candlepin.audit.HornetqEventDispatcher - Sending event: Event [id=null, target=OWNER, type=DELETED, time=Mon Jun 06 09:34:43 EDT 2016, entity=8a90c0b855]
This leaves satellite in inconsistent state, where candlepin no longer recognizes the org while it still exists in the DB. Any action involving this organization (even uploading a manifest for other org) ends up in error:
2016-06-06 09:35:00,643 [thread=http-8443-2] [req=1ad875b0, org=] INFO org.candlepin.common.filter.LoggingFilter - Request: verb=GET, uri=/candlepin/owners/foo 2016-06-06 09:35:00,663 [thread=http-8443-2] [req=1ad875b0, org=] INFO org.candlepin.resteasy.interceptor.AuthInterceptor - No such entity: Organization id: foo 2016-06-06 09:35:00,664 [thread=http-8443-2] [req=1ad875b, org=] INFO org.candlepin.common.filter.LoggingFilter - Response: status=404, content-type="application/json", time=21
Version-Release number of selected component (if applicable):
6.2.0 bet (GA14.1)
How reproducible:
always
Steps to Reproduce:
1. create an organization
2. have a host assigned to this org (you can use the satellite host itself)
3. try to delete this organization (this should fail)
4. try to create a new org and upload a manifest to it (this fails due to missing org above))
Actual results:
- candlepin removes the Org
Expected results:
- candlepin does not remove anything if the removal results in error in satellite (the removal task should be atomic)
Additional info: