Upgrade to Red Hat Satellite 6.11 fails with error "Response: 422 Unprocessable Entity" and db:seed step fails with error "Validation failed: Name has already been taken"

Solution Verified - Updated -

Issue

  • Under specific circumstances, the upgrade attempt to Red Hat Satellite 6.11 fails to complete the db:seed action:

    rake aborted!
    ActiveRecord::RecordInvalid: Validation failed: Name has already been taken
    ..
    ..
    /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/relation.rb:124:in `first_or_create!'
    /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.3.0.42/app/services/katello/organization_creator.rb:109:in `create_library_view'
    /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.3.0.42/app/services/katello/organization_creator.rb:42:in `block in seed!'
    /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/connection_adapters/abstract/database_statements.rb:278:in `transaction'
    /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/transactions.rb:212:in `transaction'
    /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.3.0.42/app/services/katello/organization_creator.rb:35:in `seed!'
    /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.3.0.42/app/services/katello/organization_creator.rb:14:in `block (2 levels) in seed_all_organizations!'
    /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/relation/delegation.rb:88:in `each'
    /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.4.7/lib/active_record/relation/delegation.rb:88:in `each'
    /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.3.0.42/app/services/katello/organization_creator.rb:13:in `block in seed_all_organizations!'
    /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:108:in `as'
    /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:114:in `as_anonymous_admin'
    /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.3.0.42/app/services/katello/organization_creator.rb:12:in `seed_all_organizations!'  
    ... 
    
  • Later, the re-execution of the upgrade skips this db:seed step entirely and fails with the following error:

    - Executing installer2022-07-11 14:46:21 [NOTICE] [configure] 2500 configuration steps out of 2661 steps complete.
    \ Executing installer2022-07-11 14:47:10 [ERROR ] [configure] /Stage[main]/Foreman::Register/Foreman_host[satellite.example.com]: Could not evaluate: Error making GET request to Foreman at https://satellite.example.com/api/v2/hosts: Response: 422 Unprocessable Entity
    / Executing installer2022-07-11 14:48:20 [NOTICE] [configure] System configuration has finished.
    

Environment

  • Red Hat Satellite 6.11

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content