Bug 2087727
Summary: | Upgrade to Satellite 6.10.5.1 fails with error message "PG::NotNullViolation: ERROR: null value in column "erratum_package_id" violates not-null constraint" | |||
---|---|---|---|---|
Product: | Red Hat Satellite | Reporter: | dgupte | |
Component: | Errata Management | Assignee: | Samir Jha <sajha> | |
Status: | CLOSED ERRATA | QA Contact: | Lukas Pramuk <lpramuk> | |
Severity: | high | Docs Contact: | ||
Priority: | high | |||
Version: | 6.10.5 | CC: | avnkumar, damoore, jbhatia, lpramuk, msunil, pcreech, sajha | |
Target Milestone: | 6.11.0 | Keywords: | Triaged, Upgrades | |
Target Release: | Unused | |||
Hardware: | All | |||
OS: | Linux | |||
Whiteboard: | ||||
Fixed In Version: | tfm-rubygem-katello-4.3.0.40-1 | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 2093405 (view as bug list) | Environment: | ||
Last Closed: | 2022-07-05 14:35:42 UTC | Type: | Bug | |
Regression: | --- | Mount Type: | --- | |
Documentation: | --- | CRM: | ||
Verified Versions: | Category: | --- | ||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
Cloudforms Team: | --- | Target Upstream Version: | ||
Embargoed: |
Description
dgupte
2022-05-18 11:05:47 UTC
Created redmine issue https://projects.theforeman.org/issues/34944 from this bug Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/34944 has been resolved. VERIFIED. @Satellite 6.11.0 Snap23 tfm-rubygem-katello-4.3.0.41-1.el7sat.noarch by adjusting the manual reproducer described in https://github.com/Katello/katello/pull/10122#issue-1242021500 and https://github.com/Katello/katello/pull/10122#issuecomment-1138943706 1) Have a Satellite 6.11.0 Snap22 2) Sync only RHEL8 Appstream repo # hammer repository-set enable --organization-id 1 --name 'Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)' --basearch x86_64 --releasever 8 # hammer product synchronize --name 'Red Hat Enterprise Linux for x86_64' --organization-id 1 --async 3) Use foreman console to produce partly migrated duplicate errata # foreman-rake console Loading production environment (Rails 6.0.4.7) > ::Katello::ModuleStreamErratumPackage.count => 10223 > ::Katello::Erratum.all.each do |errata| errata.pulp_id = errata.errata_id + 'random' errata.save! end > Katello::Repository.count => 1 > repo = ::Katello::Repository.first => #<Katello::Repository id: 1, pulp_id: "f35b4786-bf71-4ff8-af44-baf1a5f2f6b2", library_instance_id: nil, content_... > repo.index_content > ::Katello::ModuleStreamErratumPackage.count => 10223 > original = Katello::Erratum.find_by(pulp_id: 'RHBA-2022:1816') => #<Katello::Erratum id: 2282, pulp_id: "RHBA-2022:1816", errata_id: "RHBA-2022:1816", created_at: "2022-06-10 15:... > Katello::ModuleStreamErratumPackage.where(erratum_package_id: Katello::ErratumPackage.where(erratum_id: original.id)).destroy_all => [] > Katello::ErratumPackage.where(erratum_id: original.id).destroy_all => [] 4) Tear down the migration # foreman-rake db:migrate:down VERSION=20220303160220 == 20220303160220 RemoveDuplicateErrata: reverting ============================ == 20220303160220 RemoveDuplicateErrata: reverted (0.0000s) =================== 5) Run db:migrate # foreman-rake db:migrate == 20220303160220 RemoveDuplicateErrata: migrating ============================ rake aborted! StandardError: An error has occurred, this and all later migrations canceled: PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction block ... Caused by: ActiveRecord::NotNullViolation: PG::NotNullViolation: ERROR: null value in column "erratum_package_id" violates not-null constraint DETAIL: Failing row contains (1, 508, null, 2022-06-10 14:38:13.486843, 2022-06-10 17:19:38.717716). ... >>> successfully reproduced 6) Adjust internal repo to Snap23 and perform upgrade from Snap22 to Snap23 (6.11.z target version) # satellite-maintain upgrade run --target-version 6.11.z -y -w repositories-validate,repositories-setup 7) Check migration status explicitly # foreman-rake db:migrate:status | grep 20220303160220 up 20220303160220 Remove duplicate errata >>> successfully verified Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: Satellite 6.11 Release), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2022:5498 |