Project

General

Profile

Actions

Bug #14982

closed

host description migration goes throuh unfaked-host validations

Added by Ivan Necas almost 8 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Upgrades
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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:


Related issues 1 (1 open0 closed)

Related to Foreman - Bug #14983: Faking host and other models with STI in migrations doesn't work due to STINew05/10/2016Actions
Actions #1

Updated by Ivan Necas almost 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.

Actions #2

Updated by Ivan Necas almost 8 years ago

  • Related to Bug #14983: Faking host and other models with STI in migrations doesn't work due to STI added
Actions #3

Updated by The Foreman Bot almost 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
Actions #4

Updated by Ivan Necas almost 8 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #5

Updated by Eric Helms almost 8 years ago

  • translation missing: en.field_release set to 86
Actions

Also available in: Atom PDF