Bug 1420455 - Undoing a manifest import will delete ueber cert, causing problem re-fetching the cert.
Summary: Undoing a manifest import will delete ueber cert, causing problem re-fetching...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 2.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 2.0
Assignee: Michael Stead
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks: 1420406
TreeView+ depends on / blocked
 
Reported: 2017-02-08 17:15 UTC by Michael Stead
Modified: 2017-02-09 07:03 UTC (History)
3 users (show)

Fixed In Version: candlepin-2.0.25-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-02-09 07:03:16 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github candlepin candlepin pull 1467 0 None None None 2017-02-08 19:25:06 UTC

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.


Note You need to log in before you can comment on or make changes to this bug.