Bug 1375698

Summary: Manifest export raises 500 when ProductServiceAdapter.getProductById returns null
Product: [Community] Candlepin Reporter: Jonathon Turel <jturel>
Component: candlepinAssignee: candlepin-bugs
Status: CLOSED NEXTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.9.51CC: bcourt, fnguyen, redakkan, skallesh, vrjain
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-22 14:11:34 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:

Description Jonathon Turel 2016-09-13 18:23:22 UTC
Description of problem:

When SKUs are incorrectly configured (specifically: mapped to engineering products which do not exist) then ProductServiceAdapter.getProductById will return null based on the IT implementation of the adapter in Hosted Candlepin. This breaks manifest export in the Customer Portal.

Version-Release number of selected component (if applicable): 0.9.51


How reproducible: Always


Steps to Reproduce:
1. Write a unit test which will export a consumer manifest
2. Modify the test so that one of the attached SKUs gets a nil value when getProductById is called

Actual results: An exception will be raised which results in a 500 from the GET /consumers/<uuid>/export API.


Expected results: A valid manifest is returned which ignored the fact that one of the SKUs attached was mapped to an invalid Engineering Product.


Additional info:

Comment 1 Filip Nguyen 2016-09-20 06:14:56 UTC
This usually happens when SKU's change and the org doesn't have the pools refreshed. 

I don't think that ignoring 'non existent products' is correct behavior.

On the other hand, if the performance impact wouldn't be high, maybe Candlepin should run refresh pools before manifest export?

Comment 2 vritant 2016-09-22 14:11:34 UTC
We persist products in candlepin 2.0, and hence do not fetch products from product adapters during export. so we do *not* think this should occur in 2.0.

That being said, we would like to ensure that. could you provide steps to reproduce and / or other resources please ( database back ups if you have any )

Comment 3 Jonathon Turel 2016-09-22 15:37:10 UTC
We have a potential way to solve this in the Adapter code so we'll look to do that and come back to you guys if that's not feasible.

Thanks for the updates!