Project

General

Profile

Bug #27247

Red Hat Satellite 6.4 upgrade fails with error Validation failed: Name has already been taken at db:migrate stage

Added by Marek Hulán 4 months ago. Updated 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1651389

Description of problem:
Red Hat Satellite 6.4 upgrade fails with error Validation failed: Name has already been taken at db:migrate stage.

~~~
[DEBUG 2018-11-16T14:30:24 main] ActiveRecord::RecordInvalid: Validation failed: Name has already been taken
[DEBUG 2018-11-16T14:30:24 main] /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/validations.rb:78:in `raise_validation_error'
[DEBUG 2018-11-16T14:30:24 main] /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/validations.rb:50:in `save!'
[DEBUG 2018-11-16T14:30:24 main] /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/attribute_methods/dirty.rb:43:in `save!'
[DEBUG 2018-11-16T14:30:24 main] /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/transactions.rb:313:in `block in save!'
[DEBUG 2018-11-16T14:30:24 main] /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/transactions.rb:384:in `block in with_transaction_returning_status'
[DEBUG 2018-11-16T14:30:24 main] /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/database_statements.rb:233:in `transaction'
[DEBUG 2018-11-16T14:30:24 main] /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/transactions.rb:210:in `transaction'
[DEBUG 2018-11-16T14:30:24 main] /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/transactions.rb:381:in `with_transaction_returning_status'
[DEBUG 2018-11-16T14:30:24 main] /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/transactions.rb:313:in `save!'
[DEBUG 2018-11-16T14:30:24 main] /opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.6/lib/active_record/suppressor.rb:46:in `save!'
[DEBUG 2018-11-16T14:30:24 main] /usr/share/foreman/app/models/role.rb:207:in `add_permissions!'
[DEBUG 2018-11-16T14:30:24 main] /usr/share/foreman/app/services/foreman/plugin/role_lock.rb:45:in `block in update_plugin_role_permissions'
[DEBUG 2018-11-16T14:30:24 main] /usr/share/foreman/app/models/role.rb:85:in `ignore_locking'
~~~

Version-Release number of selected component (if applicable):
Red Hat Satellite 6.4

Steps to Reproduce:
Run the upgrade on Red Hat Satellite 6.3.5 -> 6.4
  1. yum update
  2. foreman-maintain upgrade run --target-version 6.4 --whitelist="disk-performance"

Actual results:
- The upgrade fails with the error.

Expected results:
- The upgrade should be completed.

Additional info:
Looks like an issue with the defaults "Roles" present in the satellite server.

History

#1 Updated by Marek Hulán 4 months ago

  • Subject changed from Red Hat Satellite 6.4 upgrade fails with error Validation failed: Name has already been taken at db:migrate stage to Red Hat Satellite 6.4 upgrade fails with error Validation failed: Name has already been taken at db:migrate stage

this is reproducible in newer version too, at least up until 1.20, we should add deduplication to the migration

#2 Updated by Marek Hulán 2 months ago

  • Project changed from Foreman to Foreman Maintain
  • Pull request https://github.com/theforeman/foreman_maintain/pull/273 added

Also available in: Atom PDF