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

Bug 923842

Summary: Importing another manifest (remove old one) after SAM version upgrade fails
Product: [Retired] Subscription Asset Manager Reporter: Garik Khachikyan <gkhachik>
Component: katelloAssignee: Devan Goodwin <dgoodwin>
Status: CLOSED CANTFIX QA Contact: SAM QE List <sam-qe-list>
Severity: unspecified Docs Contact:
Priority: urgent    
Version: 1.2CC: dgoodwin, mkoci
Target Milestone: rcFlags: gkhachik: automate_bug?
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-20 16:00:43 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:
Attachments:
Description Flags
logs none

Description Garik Khachikyan 2013-03-20 15:02:39 UTC
Description of problem:
After having upgraded SAM 1.2.1 from 1.2 (in my case) it was failing to import a new manifest (the old one was removed after upgrade) with message:
---
Subscription manifest upload for provider 'Red Hat' failed.
Reason: Failed to import archive
Resources::Candlepin::Owner: 500 Internal Server Error {"displayMessage":"Failed to import archive"} (POST /candlepin/owners/SAM-QE-1363779161/imports) (RestClient::InternalServerError)
{"displayMessage":"Failed to import archive"}
---

Version-Release number of selected component (if applicable):
SAM 1.2 latest -> SAM 1.2.1 recent puddle

How reproducible:
2 from 2 attempts

Steps to Reproduce:
1.install SAM 1.2 
2.import a manifest, register a system
3.upgrade to SAM 1.2.1
4. delete the manifest
5. try to import a new one (all was done via UI). Exception thrown (see above).
  
Actual results:
Exception. Logs are attached.

Expected results:
No exception. Customer should be able to import a new manifest!

Additional info:
attached are the logrs from katello-debug.

Comment 1 Garik Khachikyan 2013-03-20 15:21:42 UTC
Created attachment 713288 [details]
logs

Comment 2 Devan Goodwin 2013-03-20 15:36:49 UTC
This server had a manifest imported, then it was deleted, and another manifest was imported. The issue is caused by a very serious problem where briefly, rel-eng changed product ID's in hosted. This was essentially changing a primary key without consideration of the downstream services which use those content IDs in their databases.

Most likely, one of the manifests used on this server was quite old (prior to November/December of 2012), and the other was newer. (though there are a lot of date ranges this could have happened in) 

There is unfortunately no easy fix for this, only a straight to the database workaround, for details and the workaround script see:

https://github.com/candlepin/candlepin/blob/master/fixes/update-content-ids.py

This script should need to be run only once assuming that the old manifest was the one that was imported first. If the older manifest is the one that is failing now, try just regenerating it in hosted or getting a new manifest. In that scenario the workaround should not be necessary.

Rel-eng confirmed when this issue was encountered that they would no longer do this so the problem should not be appearing unless you are using old manifests. *If* this was encountered with newer manifests (both earlier than say last December) then please notify us immediately, that would indicate they did this again and we're about to see mass breakage.

Going to close this for now as this is a known and unfixable issue, we can reopen if anything needs to be done.

Comment 3 Devan Goodwin 2013-03-20 15:39:46 UTC
Garik if you could track down the two manifests that were used on this system it would help confirm *for sure* that this is exactly what happened.

Comment 4 Devan Goodwin 2013-03-20 15:41:44 UTC
If it helps, I think the manifest filenames were: 

import_24a0691a0b396950fc58.zip
import_a3071b8e4b3ba83f1ef4.zip

Both were imported into org SAM-QE-1363779161.

Comment 5 Devan Goodwin 2013-03-20 16:00:43 UTC
Garik has confirmed the first manifest was quite old, then a brand new one, thus our error.

So this is a known issue with old manifests, the workaround script is linked above if necessary. Otherwise we have to close as there is no real fix that can be done aside from rel-eng not changing these IDs anymore, which should not be happening any more as of last December.

Closing!