Bug #14982
closedhost description migration goes throuh unfaked-host validations
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1333774
Description of problem:
foreman-installer --upgrade (from 6.2.0 Beta to GA10) failed.
foreman-installer/katello.log (attached) is showing the following
StandardError: An error has occurred, this and all later migrations canceled:
Validation failed: Build mode cannot be enabled for an unmanaged host/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/validations.rb:57:in `save!'
- My satellite contains multiple hosts with one of them being unmanaged.
after marking it 'managed' using UI, the installer proceeds (and fails on different error reported in: BZ#1333769)
Version-Release number of selected component (if applicable):
6.2.0 GA10
Steps to Reproduce:
1. yum upgrade
2. foreman-installer --upgrade
Actual results:
Validation failed: Build mode cannot be enabled for an unmanaged host/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/validations.rb:57:in `save!'
Expected results:
upgrade works
Additional info:
Updated by Ivan Necas over 8 years ago
- Subject changed from foreman-installer upgrade fails if unmanaged hosts exist on satellite to host description migration goes throuh unfaked-host validations
The problem is the way we fake the host object doesn't work with STI and the `host.save!` uses
the real host
https://github.com/Katello/katello/blob/master/db/migrate/20160426145517_move_host_description_to_host_comment.rb#L13
The workaround is to use `update_column` instead of the `save!` to avoid the validations to be run.
I'm filling another issue against Foreman core to provide better a better way to work with data in migrations.
Updated by Ivan Necas over 8 years ago
- Related to Bug #14983: Faking host and other models with STI in migrations doesn't work due to STI added
Updated by The Foreman Bot over 8 years ago
- Status changed from New to Ready For Testing
- Assignee set to Ivan Necas
- Pull request https://github.com/Katello/katello/pull/6032 added
Updated by Ivan Necas over 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset katello|41bff5042835cd02e436351498edacf927c8a0fc.
Updated by Eric Helms over 8 years ago
- Translation missing: en.field_release set to 86