Bug #22056
closedBroken content view blocks the 6.2->6.3 upgrade and leaves the system in a broken state
Description
Description of problem:
'foreman-maintain upgrade run --target-version 6.3' fails if there is an orphaned content view in the system. It leaves the system in a broken state and it's impossible to get any info from it using hammer/etc. (ERF64-6496 [Foreman::MaintenanceException]: There are migrations pending in the system.).
'foreman-maintain upgrade check --target-version 6.3' doesn't detect any problems.
Version-Release number of selected component (if applicable):
Satellite 6.3 Beta
How reproducible:
100%
Actual results:
====================================================================
$ foreman-maintain upgrade check --target-version 6.3
-- add_column(:katello_content_facets, :installable_security_errata_count, :integer, {:null=>false, :default=>0})
-
-
-
-
foreman-rake db:migrate failed! Check the output for error!
Upgrade step migrate_foreman failed. Check logs for more information.
[FAIL]
Failed executing satellite-installer --upgrade, exit status 1
-------------------------------------------------------------------------------
Scenario [Migration scripts to Satellite 6.3] failed.
The following steps ended up in failing state:
[installer-upgrade]
Resolve the failed steps and rerun
the command. In case the failures are false positives,
use --whitelist="installer-upgrade"
$ hammer ping
ERF64-6496 [Foreman::MaintenanceException]: There are migrations pending in the system.
$ cat /var/log/foreman-installer/satellite.log
...
[DEBUG 2017-12-18 13:23:14 main] 20170223114114 LockSeededTemplates: migrating ============================rake aborted!
[DEBUG 2017-12-18 13:23:14 main] StandardError: An error has occurred, this and all later migrations canceled:
[DEBUG 2017-12-18 13:23:14 main]
[DEBUG 2017-12-18 13:23:14 main] Validation failed: Content view 'atomic-test' is not in environment 'Library'/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/validations.rb:79:in `raise_record_invalid'
[DEBUG 2017-12-18 13:23:14 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/validations.rb:43:in `save!'
[DEBUG 2017-12-18 13:23:14 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
[DEBUG 2017-12-18 13:23:14 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `block in save!'
...
====================================================================
Expected results:
foreman-maintain complains before installation.
Updated by Justin Sherrill over 5 years ago
This is likely a duplicate of https://projects.theforeman.org/issues/24768