Bug 2012897
Summary: | When removing an associated CR host from Satellite it fails as 'PG::ForeignKeyViolation'. | ||
---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Rudnei Bertol Jr. <rbertolj> |
Component: | Compute Resources | Assignee: | satellite6-bugs <satellite6-bugs> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Satellite QE Team <sat-qe-bz-list> |
Severity: | high | Docs Contact: | |
Priority: | high | ||
Version: | 6.9.0 | CC: | ahumbe, ajambhul, akapse, aruzicka, hakon.gislason, inecas, jbhatia, jiri.blaha, kkinge, michaelparin, momran, ramsingh, rlavi, satellite6-bugs, saydas, shane.seymour, shwsingh, tim.denholm, vdeshpan |
Target Milestone: | Unspecified | Keywords: | PrioBumpGSS |
Target Release: | Unused | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2023-08-10 16:21:15 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
Rudnei Bertol Jr.
2021-10-11 14:39:19 UTC
The team has been unable to reproduce the behavior described on Satellite 6.12.z, 6.13.z and the upcoming 6.14.0 (internal builds) release. For this reason, we are moving this to CLOSED:CURRENTRELEASE. If there are concerns or the issue persists, please feel free to re-open providing details to reproduce. Thanks! Just ran into this issue on satellite-6.13.3-1.el8sat.noarch. PG::ForeignKeyViolation: ERROR: update or delete on table "hosts" violates foreign key constraint "host_status_hosts_host_id_fk" on table "host_status" DETAIL: Key (id)=(8386) is still referenced from table "host_status". I tried the resolution in https://access.redhat.com/solutions/6524891 but that did not work. Is there a workaround? root@iu-satellite:~# foreman-rake console Loading production environment (Rails 6.1.7) irb(main):001:0> host = Host.find_by(:name => 'ru-ansible-molecule-el7-1.decode.is') => #<Host::Managed id: 8386, name: "ru-ansible-molecule-el7-1.decode.is", last_compile: "2023-05-31 22:23:09.000000000 +0000", last_report: [FILTERED], updated_at: "2023-08-21 09:17:05.879189000 +0000", created_at: "2023-03-24 15:34:18.594942000 +0000", root_pass: [FILTERED], architecture_id: 1, operatingsystem_... irb(main):002:0> host.update_attribute(:managed, false) => true irb(main):004:0> host.disassociate! => true irb(main):005:0> host.destroy! Traceback (most recent call last): 2: from lib/tasks/console.rake:5:in `block in <top (required)>' 1: from (irb):5 ActiveRecord::InvalidForeignKey (PG::ForeignKeyViolation: ERROR: update or delete on table "hosts" violates foreign key constraint "host_status_hosts_host_id_fk" on table "host_status") DETAIL: Key (id)=(8386) is still referenced from table "host_status". irb(main):006:0> Hello The following within foreman-rake console will get rid of the different Host Statues and you should no longer run into that violation h = Host.find_by(:name => 'ru-ansible-molecule-el7-1.decode.is') HostStatus::Status.where(host_id: h.id).delete_all STEP 4 from https://access.redhat.com/solutions/4529531 contains the entire sequence of host deletion by rake console Thanks, that worked. Please add that to the knowledgebase solution article. Good to hear that it worked. It was done almost the same time when I posted the solution. That KB now also points to https://access.redhat.com/solutions/4529531 for additional steps of deletion via rake console ( if needed by someone ) |