Project

General

Profile

Bug #15655

[upgrade] db migrate failed with error: undefined local variable or method `openscap_proxy_id'

Added by Shlomi Zadok about 4 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
DB migrations
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1353436
Description of problem:
While performing upgrade from sat6.1.9 -> sat62 GA snap19, db:migration failed with error:

StandardError: An error has occurred, this and all later migrations canceled:

undefined local variable or method `openscap_proxy_id' for #<Hostgroup:0x0000000df0b150>/opt/rh/rh-ror41/root/usr/share/gems/gems/activemodel-4.1.5/lib/active_model/attribute_methods.rb:435:in `method_missing'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/attribute_methods.rb:208:in `method_missing'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-0.5.3.14/app/models/concerns/foreman_openscap/openscap_proxy_core_extensions.rb:66:in `openscap_proxy_has_feature'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:424:in `block in make_lambda'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:184:in `call'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:184:in `block in simple'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `call'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `block in simple'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `call'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `block in simple'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activesupport-4.1.5/lib/active_support/callbacks.rb:185:in `call'

Version-Release number of selected component (if applicable):
sat62 GA snap19

How reproducible:
always

Steps to Reproduce:
0. Make sure openscap packages are installed on sat6.1
1. set Sat6.2 repo
2. katello-service stop
3. yum update -y
4. satellite-installer --scenario satellite --upgrade

Actual results:

Expected results:
db: migration succeed and installer should complete successfully

Additional info:


Related issues

Related to Foreman - Refactor #15866: Provide alternative way of migrating data as oposed misuing db:migrate for this purposeNew2016-07-27

Associated revisions

Revision cf37d1f4 (diff)
Added by Shlomi Zadok about 4 years ago

Fixes #15655 - Improve ptable migration

Update host and hostgroups in migration without running validation. Some
plugins failed to run the migration because Host or Hostgroups added
validations for fields that did not exist at the time this migration was
created.
This change also improves performance of the migration by using the
`update_all` method instead of looping over all elements.

History

#1 Updated by Shlomi Zadok about 4 years ago

  • Project changed from OpenSCAP to Foreman
  • Category set to Database

The problem is at the migration itself, as ptable_id is set on the hostgroup (hence an update on hostgroup)
This may happen on other plugins that add validation to the hostgroup.

#2 Updated by The Foreman Bot about 4 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3639 added

#3 Updated by The Foreman Bot about 4 years ago

  • Pull request https://github.com/theforeman/foreman_openscap/pull/178 added

#4 Updated by Shlomi Zadok about 4 years ago

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

#5 Updated by Dominic Cleal about 4 years ago

  • Category changed from Database to DB migrations
  • Legacy Backlogs Release (now unused) set to 160

#6 Updated by Ohad Levy about 4 years ago

  • Pull request deleted (https://github.com/theforeman/foreman_openscap/pull/178)

#7 Updated by Ivan Necas about 4 years ago

  • Related to Refactor #15866: Provide alternative way of migrating data as oposed misuing db:migrate for this purpose added

Also available in: Atom PDF