Bug 1339763

Summary: Upgrade with an existing capsule fails with migration issues
Product: Red Hat Satellite Reporter: John Mitsch <jomitsch>
Component: UpgradesAssignee: Brad Buckingham <bbuckingham>
Status: CLOSED DUPLICATE QA Contact: Katello QA List <katello-qa-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
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-05-26 01:46:25 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: 1335807    
Attachments:
Description Flags
upgrade logs
none
satellite.log.run3 none

Description John Mitsch 2016-05-25 19:28:27 UTC
Created attachment 1161593 [details]
upgrade logs

Description of problem:
db:seed step is failing during upgrade

In the logs I found: (attached is full output)

StandardError: An error has occurred, this and all later migrations canceled:
Could not find the source association(s) :content_facets in model MigrateContentHosts::ContentFacetRepository. Try 'has_many :bound_repositories, :through => :content_facet_repositories, :source => <name>'. Is it one of content_facet or repository?/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/reflection.rb:698:in `check_validity!'

This seems to only happen when a capsule is installed and a repo is synced

Version-Release number of selected component (if applicable):
6.1 > 6.2

How reproducible:
Always

Steps to Reproduce:
1.Install 6.1
2.Install a capsule
3.Sync at least one repo
4.Upgrade to 6.2

Actual results:
Upgrade fails

Expected results:
Upgrade succeeds


Additional info:

Comment 1 Brad Buckingham 2016-05-26 00:56:46 UTC
After addressing the error in the description, the next error is:

PG::Error: ERROR:  update or delete on table "katello_systems" violates foreign key constraint "smart_proxies_content_host_id_fk" on table "smart_proxies"
DETAIL:  Key (id)=(2) is still referenced from table "smart_proxies".
: DELETE FROM "katello_systems" WHERE "katello_systems"."id" = $1/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/connection_adapters/postgresql_adapter.rb:834:in `get_last_result'


Attaching satellite.log.run3 with full details.

Comment 2 Brad Buckingham 2016-05-26 00:57:18 UTC
Created attachment 1161675 [details]
satellite.log.run3

Comment 3 Brad Buckingham 2016-05-26 01:42:51 UTC
Created redmine issue http://projects.theforeman.org/issues/15193 from this bug

Comment 4 Brad Buckingham 2016-05-26 01:46:25 UTC
There were actually several errors related to getting the 'MigrateContentHosts' migration to succeed.  The first one was documented in bug 1339682.  Since that bug has not been merged yet and the overall changes are small, I am going to bundle all of the changes bug 1339682.  This will reduce overhead on the release and QE teams.

*** This bug has been marked as a duplicate of bug 1339682 ***