Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2004158 - Sat 6.9.5: foreman-rake facts:clean aborts due to foreign key in database
Summary: Sat 6.9.5: foreman-rake facts:clean aborts due to foreign key in database
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Fact
Version: 6.9.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: 6.11.0
Assignee: Tomer Brisker
QA Contact: Peter Ondrejka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-09-14 15:17 UTC by Vincent S. Cojot
Modified: 2024-12-20 21:03 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-07-05 14:29:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 30028 0 Normal New foreman-rake facts:clean fails with foreign key constraint violation 2021-10-18 13:30:59 UTC
Red Hat Product Errata RHSA-2022:5498 0 None None None 2022-07-05 14:29:46 UTC

Description Vincent S. Cojot 2021-09-14 15:17:19 UTC
Description of problem:

On Satellite 6.9.5, I'm getting this failure:

[root@sat6 ~]# foreman-rake facts:clean COMMIT=true --trace
** Invoke facts:clean (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute facts:clean
Starting orphaned facts clean up
rake aborted!
ActiveRecord::InvalidForeignKey: PG::ForeignKeyViolation: ERROR:  update or delete on table "fact_names" violates foreign key constraint "fact_values_fact_name_id_fk" on table "fact_values"
DETAIL:  Key (id)=(5153) is still referenced from table "fact_values".
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/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.4/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.4/lib/active_support/dependencies
[......]


Version-Release number of selected component (if applicable):
satellite 6.9.5 (fresh upgrade from 6.8.6)

Comment 1 Tomer Brisker 2021-10-18 13:30:58 UTC
Connecting redmine issue https://projects.theforeman.org/issues/30028 from this bug

Comment 2 Bryan Kearney 2021-11-04 13:51:26 UTC
Upstream bug assigned to tbrisker

Comment 3 Bryan Kearney 2021-11-04 13:51:27 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/30028 has been resolved.

Comment 4 Peter Ondrejka 2022-04-26 13:37:02 UTC
Checked on Satellite 6.11 snap 17, I inserted several entries into the fact_names table: compose/non-compse, without matching fact_values, with null fact values, etc. When running "foreman-rake facts:clean COMMIT=true --trace":
- fact_names without fact_values are removed
- non-compose fact_name with fact_value is left alone without error 
- compose fact_name with empty fact_value is removed 
- compose fact_name with non-empty fact_value is left alone without error

Comment 7 errata-xmlrpc 2022-07-05 14:29:38 UTC
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


Note You need to log in before you can comment on or make changes to this bug.