Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1420455

Summary: Undoing a manifest import will delete ueber cert, causing problem re-fetching the cert.
Product: [Community] Candlepin (Migrated to Jira) Reporter: Michael Stead <mstead>
Component: candlepinAssignee: Michael Stead <mstead>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: high Docs Contact:
Priority: high    
Version: 2.0CC: redakkan, skallesh, vrjain
Target Milestone: ---   
Target Release: 2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: candlepin-2.0.25-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-09 07:03:16 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: 1420406    

Description Michael Stead 2017-02-08 17:15:37 UTC
If an ueber certificate exists for an Owner when a manifest import is undone, the ueber certifcate will be deleted. This will leave the ueber data in a bad state and will break the GET /owners/:owner_key/uebercert API.


Steps to Reproduce:
1. Create a new owner.

2. Import a manifest for that owner.

3. Generate an ueber certificate for that owner.
curl -k -u admin:admin -X POST https://localhost:8443/candlepin/owners/:owner_key/uebercert

4. Undo the manifest that was imported.
curl -k -u admin:admin -X DELETE https://localhost:8443/candlepin/owners/:owner_key/imports

5. Fetch the ueber cert for the owner.
curl -k -u admin:admin https://localhost:8443/candlepin/owners/:owner_key/uebercert



Actual results:

2017-02-08 13:02:22,308 [thread=http-nio-8443-exec-3] [req=4b76a72e-e753-4952-aefe-b2419fa50e03, org=] INFO  org.candlepin.common.filter.LoggingFilter - Request: verb=GET, uri=/candlepin/owners/defaultorg/uebercert
2017-02-08 13:02:22,355 [thread=http-nio-8443-exec-3] [req=4b76a72e-e753-4952-aefe-b2419fa50e03, org=defaultorg] ERROR org.candlepin.common.exceptions.mappers.CandlepinExceptionMapper - Runtime Error Index: 0, Size: 0 at java.util.ArrayList.rangeCheck:653
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653) ~[na:1.8.0_111]
	at java.util.ArrayList.get(ArrayList.java:429) ~[na:1.8.0_111]
	at org.candlepin.resource.OwnerResource.getUeberCertificate(OwnerResource.java:1440) ~[classes/:]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_111]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_111]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_111]


Expected results:
An appropriate ueber certificate should be returned by the ueber cert API after the manifest is removed.

Comment 1 Michael Stead 2017-02-08 17:27:32 UTC
Candlepin's UndoImportsJob is deleting the Ueber Pools/Entitlements along with the pools that were imported as part of the manifest. The ueber pools should be left alone.