Bug 1476882

Summary: Upgrading with an orphaned product/repository results in 404 Error on redhat repos page
Product: [Community] Candlepin Reporter: Kevin Howell <khowell>
Component: candlepinAssignee: Chris "Ceiu" Rog <crog>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: high Docs Contact:
Priority: high    
Version: 2.0CC: jsherril, katello-qa-list, redakkan, skallesh
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1476386
: 1476883 (view as bug list) Environment:
Last Closed: 2019-09-24 17:13:46 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: 1476386    

Description Kevin Howell 2017-07-31 17:31:31 UTC
+++ This bug was initially created as a clone of Bug #1476386 +++

Description of problem:

After upgrading to 6.3 with an orphaned redhat repository/product, the redhat repositories page errors with a 404 from candlepin


How reproducible:
Always

Steps to Reproduce:
1.  On Satellite 6.2 (pre upgrade): Import a manifest
2.  Enable at least one repository
3.  Delete the manifest
4.  Upgrade to 6.3
5.  Visit the 'Red Hat Repositories" page

Actual results:
Error, the logs:

2017-07-28 16:03:22 33c833b3 [app] [F] 
 | RestClient::ResourceNotFound (Katello::Resources::Candlepin::Product: 404 Resource Not Found {"displayMessage":"Product with ID '367' could not be found.","requestUuid":"b3991f0f-62a2-4933-bda2-f93e9c4843f4"} (GET /candlepin/owners/Default_Organization/products/367/?include=name&include=attributes.name&include=attributes.value&include=productContent.content.contentUrl&include=productContent.content.label&include=productContent.content.modifiedProductIds&include=productContent.content.type&include=productContent.content.id&include=productContent.content.name)):


Expected results:
page loads fine

Additional info:
Note that deleting the manifest is the easiest way to reproduce this, but it can also happen if some subscription expired, or you've imported/refreshed a new manifest that doesn't contain the product that has a repository enabled (thus is orphaned).

--- Additional comment from Justin Sherrill on 2017-07-31 12:29:27 EDT ---

Connecting redmine issue http://projects.theforeman.org/issues/20245 from this bug