Project

General

Profile

Bug #27220

upgrade from foreman 1.20.1 to 1.21.3 - db migration fails

Added by Christian Fuchs over 1 year ago. Updated about 1 year ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
DB migrations
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

I am trying to update Foreman from version 1.20.1 to 1.21.3. Foreman 1.21.3 is build from source.

Running the db migration results in the following error:

RAILS_ENV=production bundle exec rake db:migrate
WARNING: Nokogiri was built against LibXML version 2.9.9, but has dynamically loaded 2.9.4
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
== 20181116104823 FixedIgnoreTaxonomiesForAuditFilters: migrating =============
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

Validation failed: Search invalid search query: Field 'host.hostgroup_title' not recognized for searching!
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/validations.rb:80:in `raise_validation_error'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/validations.rb:52:in `save!'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:315:in `block in save!'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:387:in `block in with_transaction_returning_status'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:252:in `transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:212:in `transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:385:in `with_transaction_returning_status'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:315:in `save!'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/suppressor.rb:48:in `save!'
/opt/foreman/db/migrate/20181116104823_fixed_ignore_taxonomies_for_audit_filters.rb:11:in `block in up'
/opt/foreman/db/migrate/20181116104823_fixed_ignore_taxonomies_for_audit_filters.rb:4:in `each'
/opt/foreman/db/migrate/20181116104823_fixed_ignore_taxonomies_for_audit_filters.rb:4:in `up'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:817:in `exec_migration'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:798:in `block (2 levels) in migrate'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:797:in `block in migrate'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:414:in `with_connection'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:796:in `migrate'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:977:in `migrate'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1292:in `block in execute_migration_in_transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1343:in `block in ddl_transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in `block in transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in `transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:212:in `transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1343:in `ddl_transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1291:in `execute_migration_in_transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1263:in `block in migrate_without_lock'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1262:in `each'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1262:in `migrate_without_lock'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1210:in `block in migrate'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1363:in `with_advisory_lock'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1210:in `migrate'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1036:in `up'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1011:in `migrate'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <top (required)>'
/opt/foreman/vendor/ruby/2.4.0/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'

Caused by:
ActiveRecord::RecordInvalid: Validation failed: Search invalid search query: Field 'host.hostgroup_title' not recognized for searching!
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/validations.rb:80:in `raise_validation_error'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/validations.rb:52:in `save!'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:315:in `block in save!'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:387:in `block in with_transaction_returning_status'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:252:in `transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:212:in `transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:385:in `with_transaction_returning_status'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:315:in `save!'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/suppressor.rb:48:in `save!'
/opt/foreman/db/migrate/20181116104823_fixed_ignore_taxonomies_for_audit_filters.rb:11:in `block in up'
/opt/foreman/db/migrate/20181116104823_fixed_ignore_taxonomies_for_audit_filters.rb:4:in `each'
/opt/foreman/db/migrate/20181116104823_fixed_ignore_taxonomies_for_audit_filters.rb:4:in `up'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:817:in `exec_migration'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:798:in `block (2 levels) in migrate'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:797:in `block in migrate'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:414:in `with_connection'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:796:in `migrate'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:977:in `migrate'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1292:in `block in execute_migration_in_transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1343:in `block in ddl_transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in `block in transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:254:in `transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/transactions.rb:212:in `transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1343:in `ddl_transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1291:in `execute_migration_in_transaction'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1263:in `block in migrate_without_lock'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1262:in `each'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1262:in `migrate_without_lock'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1210:in `block in migrate'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1363:in `with_advisory_lock'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1210:in `migrate'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1036:in `up'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:1011:in `migrate'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/opt/foreman/vendor/ruby/2.4.0/gems/activerecord-5.2.1/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <top (required)>'
/opt/foreman/vendor/ruby/2.4.0/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

History

#1 Updated by Christian Fuchs over 1 year ago

Christian Fuchs wrote:

I am trying to update Foreman from version 1.20.1 to 1.21.3. Foreman 1.21.3 is build from source.

Running the db migration results in the following error:
[...]

never mind i figured it out :p

solution:
we started with foreman 1.10X and migratet from version to version. some admins used role filter with the search string "host.hostgroup_title ~". till foreman 1.20.X this seems to be ok, but upgrading to 1.21 breaks the migration.
so i removed all search strings with "host.hostgroup_title ~" and startet the upgrade again and it works :)

#2 Updated by Tomer Brisker about 1 year ago

  • Status changed from New to Resolved

marking as resolved per comment #1

Also available in: Atom PDF