This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
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 2150371 - Removing CV error's with "Cannot delete record because of dependent content_facet"
Summary: Removing CV error's with "Cannot delete record because of dependent content_f...
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Content Views
Version: 6.11.3
Hardware: x86_64
OS: Linux
high
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Satellite QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-12-02 17:45 UTC by tharring
Modified: 2024-10-05 04:25 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-06-06 12:55:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker   SAT-18610 0 None Migrated None 2024-06-06 12:55:50 UTC
Red Hat Knowledge Base (Solution) 7018287 0 None None None 2023-06-26 12:32:10 UTC

Description tharring 2022-12-02 17:45:23 UTC
Description of problem:  Removing CV error's with "Cannot delete record because of dependent content_facet"

How reproducible: 


Steps to Reproduce:
1. Move all Hosts from CV to another
2. Delete CV
3.

Actual results:
Will not allow deleting the CV with the error "Cannot delete record because of dependent content_facet"


Expected results:
Delete the CV 


Additional info:
Workaround was as below:

# foreman-rake console
> pp ::Katello::ContentView.find_by(name: 'GEL-PROD-8_2-DevSuite').content_facets.first
---

Note. The name of your CV is "GEL-PROD-8_2-DevSuite" and it should be empty. However, we can see an entry over there
---
#<Katello::Host::ContentFacet:0x00005640b91e8778
 id: 464,
 host_id: 498,
 uuid: "aaed8122-84da-4b1f-afa2-1a03944079a2",
 content_view_id: 4,
 lifecycle_environment_id: 1,
 kickstart_repository_id: nil,
 content_source_id: nil,
 installable_security_errata_count: 0,
 installable_enhancement_errata_count: 0,
 installable_bugfix_errata_count: 0,
 applicable_rpm_count: 0,
 upgradable_rpm_count: 0,
 applicable_module_stream_count: 0,
 upgradable_module_stream_count: 0,
 applicable_deb_count: 0,
 upgradable_deb_count: 0>
---


We can see that the host_id is 498 and id is 464, another way to confirm that this is not anymore in your environment, it's trying to access the link below

	https://your_satellite_fqdn_here/content_hosts/498
	
	Note. This will return "Danger alert:Resource host not found by id '498'"


In order to fix, yet on "foreman-rake console"
---
> ::Katello::Host::ContentFacet.find(464)
> ::Katello::Host::ContentFacet.find(464).destroy!
> ::Katello::Host::ContentFacet.find(464)
---

Once we got more than one object lost in your content facet, we created a rake that will do the cleanup for you. Just follow as below

1. Create the file cleanup.rake with the content below
---
::Katello::ContentView.find_by(name: 'GEL-PROD-8_2-DevSuite').content_facets.each do |h|
   puts "#{h.id}"
  ::Katello::Host::ContentFacet.find(h.id).destroy
end
---

2. Call the foreman-rake passing the file
---
# foreman-rake console < cleanup.rake

Comment 1 wclark 2022-12-05 14:14:47 UTC
If anybody else runs into this issue, it seems that the bug is that the Host was removed somehow without removing its associated ContentFacet.

Logs of the original removal of the Host would be helpful to better understand the issue.

Comment 2 Samir Jha 2023-04-06 14:01:53 UTC
We have added a foreman-rake task clean_orphaned_facets to deal with this. That was part of the fix of a different BZ with the same root cause.
https://bugzilla.redhat.com/show_bug.cgi?id=2147579.

We can probably add some information when CV delete fails due to an orphaned content host in the system.

Comment 3 Eric Helms 2024-06-06 12:55:51 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.

Comment 4 Red Hat Bugzilla 2024-10-05 04:25:41 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days


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