Project

General

Profile

Actions

Bug #34488

closed

Upgrade to Katello 4.1 fails at db:migrate stage if there are errata reference present for some ostree\puppet type repos

Added by Samir Jha almost 3 years ago. Updated almost 3 years ago.

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

Description

Description of problem:

Upgrade to Satellite 6.10 fails at db:migrate stage if there are errata references present for some ostree\puppet type repos

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

Satellite 6.10.1

How reproducible:

By customer

Steps to Reproduce:

NA

Actual results:

foreman-rake db:migrate --trace --verbose
'ErbParser' is ignored.
'RubyParser' is ignored.
  • Invoke db:migrate (first_time)
  • Invoke db:load_config (first_time)
  • Invoke environment (first_time)
  • Execute environment
    API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
  • Execute db:load_config
  • Invoke plugin:refresh_migrations (first_time)
  • Invoke environment
  • Execute plugin:refresh_migrations
  • Execute db:migrate
    20210119162528 DeletePuppetAndOstreeRepos: migrating =====================
    rake aborted!
    StandardError: An error has occurred, this and all later migrations canceled:

PG::ForeignKeyViolation: ERROR: update or delete on table "katello_repositories" violates foreign key constraint "katello_repository_errata_repo_id_fk" on table "katello_repository_errata"
DETAIL: Key (id)=(205) is still referenced from table "katello_repository_errata".
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `async_exec_params'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql_adapter.rb:675:in `block (2 levels) in exec_no_cache'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql_adapter.rb:674:in `block in exec_no_cache'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract_adapter.rb:722:in `block (2 levels) in log'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract_adapter.rb:721:in `block in log'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract_adapter.rb:712:in `log'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql_adapter.rb:673:in `exec_no_cache'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql_adapter.rb:656:in `execute_and_clear'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql/database_statements.rb:111:in `exec_delete'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/database_statements.rb:180:in `delete'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract/query_cache.rb:22:in `delete'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/relation.rb:587:in `delete_all'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/relation.rb:616:in `delete_by'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/querying.rb:21:in `delete_by'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/persistence.rb:352:in `delete'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.39/db/migrate/20210119162528_delete_puppet_and_ostree_repos.rb:44:in `block in up'
/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.1.1.39/db/migrate/20210119162528_delete_puppet_and_ostree_repos.rb:43:in `up'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/activ

Expected results:

Although it makes no sense that how some errata content will get tied up with ostree or puppet type repos but, Upgrade should be able to take care of them

Additional info:

Check:

  1. echo "Katello::RepositoryErratum.where(:repository_id => Katello::Repository.where(:root_id => Katello::RootRepository.where(:content_type => [:ostree, :puppet])))" | foreman-rake console
    'ErbParser' is ignored.
    'RubyParser' is ignored.
    API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
    Loading production environment (Rails 6.0.3.7)
    Switch to inspect mode.
    Katello::RepositoryErratum.where(:repository_id => Katello::Repository.where(:root_id => Katello::RootRepository.where(:content_type => [:ostree, :puppet])))
    #<ActiveRecord::Relation [#<Katello::RepositoryErratum id: 4334583, erratum_id: 14645, repository_id: 205, created_at: "2022-01-02 22:50:12", updated_at: "2022-01-02 22:50:12", erratum_pulp3_href: "/pulp/api/v3/content/rpm/advisories/ddbb01dd-dbac-...">, #<Katello::RepositoryErratum id: 4334572, erratum_id: 14755, repository_id: 205, created_at: "2022-01-02 22:50:12", updated_at: "2022-01-02 22:50:12", erratum_pulp3_href: "/pulp/api/v3/content/rpm/advisories/93e99769-9f00-...">, #<Katello::RepositoryErratum id: 4334561, erratum_id: 14513, repository_id: 205, created_at: "2022-01-02 22:50:12", updated_at: "2022-01-02 22:50:12", erratum_pulp3_href: "/pulp/api/v3/content/rpm/advisories/047078a2-cc48-...">, #<Katello::RepositoryErratum id: 4334550, erratum_id: 15711, repository_id: 205, created_at: "2022-01-02 22:50:12", updated_at: "2022-01-02 22:50:12", erratum_pulp3_href: "/pulp/api/v3/content/rpm/advisories/4e30d8f4-7afb-...">, #<Katello::RepositoryErratum id: 4334539, erratum_id: 13900, repository_id: 205, created_at: "2022-01-02 22:50:12", updated_at: "2022-01-02 22:50:12", erratum_pulp3_href: "/pulp/api/v3/content/rpm/advisories/424c8b03-9cc3-...">, #<Katello::RepositoryErratum id: 4334528, erratum_id: 13129, repository_id: 205, created_at: "2022-01-02 22:50:12", updated_at: "2022-01-02 22:50:12", erratum_pulp3_href: "/pulp/api/v3/content/rpm/advisories/588087e2-29e0-...">, #<Katello::RepositoryErratum id: 4334517, erratum_id: 13509, repository_id: 205, created_at: "2022-01-02 22:50:12", updated_at: "2022-01-02 22:50:12", erratum_pulp3_href: "/pulp/api/v3/content/rpm/advisories/e56273c2-0d89-...">, #<Katello::RepositoryErratum id: 4334506, erratum_id: 15012, repository_id: 205, created_at: "2022-01-02 22:50:12", updated_at: "2022-01-02 22:50:12", erratum_pulp3_href: "/pulp/api/v3/content/rpm/advisories/cb36e9ea-c439-...">, #<Katello::RepositoryErratum id: 4334495, erratum_id: 15838, repository_id: 205, created_at: "2022-01-02 22:50:12", updated_at: "2022-01-02 22:50:12", erratum_pulp3_href: "/pulp/api/v3/content/rpm/advisories/a6b02407-749c-...">, #<Katello::RepositoryErratum id: 4334484, erratum_id: 13659, repository_id: 205, created_at: "2022-01-02 22:50:12", updated_at: "2022-01-02 22:50:12", erratum_pulp3_href: "/pulp/api/v3/content/rpm/advisories/98703765-3ac4-...">, ...]>

Fix:

  1. echo "Katello::RepositoryErratum.where(:repository_id => Katello::Repository.where(:root_id => Katello::RootRepository.where(:content_type => [:ostree, :puppet]))).delete_all" | foreman-rake console
  • Re-run db:migrate and if successfull, re-run the upgrade.
Actions

Also available in: Atom PDF