Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1122736

Summary: Unable to delete host tied back to activation key
Product: Red Hat Satellite Reporter: Jason Montleon <jmontleo>
Component: WebUIAssignee: Brad Buckingham <bbuckingham>
WebUI sub component: Katello QA Contact: Tazim Kolhar <tkolhar>
Status: CLOSED CURRENTRELEASE Docs Contact:
Severity: high    
Priority: unspecified CC: bbuckingham, cwelton, tkolhar
Version: 6.0.4Keywords: Triaged
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/7005
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-11 12:21:21 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 Jason Montleon 2014-07-23 23:47:52 UTC
Description of problem:
I tried to delete a host and received a trace. Afterwards I could not view the host details though I could see it in the host list

Version-Release number of selected component (if applicable):
ruby193-rubygem-katello-1.5.0-65.el6sat.noarch

How reproducible:
Uncertain, but based on the additional info, probably always

Steps to Reproduce:
1. Create an Activation Key
2. Create a Host and include the activation key

Actual results:
Can't delete the host without error

Expected results:
Host should delete as expected

Additional info:
I had to do the following:
delete from hosts where id = 7;
ERROR:  update or delete on table "hosts" violates foreign key constraint "katello_systems_host_id" on table "katello_systems"
DETAIL:  Key (id)=(7) is still referenced from table "katello_systems".

delete from katello_systems where id = 11;
ERROR:  update or delete on table "katello_systems" violates foreign key constraint "system_activation_keys_system_id_fk" on table "katello_system_activation_keys"
DETAIL:  Key (id)=(11) is still referenced from table "katello_system_activation_keys".


foreman=# delete from katello_system_activation_keys where id = 11;
DELETE 1
foreman=# delete from katello_systems where id = 11;
DELETE 1
foreman=# delete from hosts where id = 7;
DELETE 1
foreman=# \q

Comment 1 RHEL Program Management 2014-07-23 23:53:34 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 Jason Montleon 2014-07-29 17:26:21 UTC
After seeing this again I believe this is happening when the host gets re-provisioned (and this re-activated using subscription-manager) by putting it back into build. It looks like multiple content hosts end up referencing the host. I went to delete a host after several reprovisions and there were 7 or 8 content hosts with the same name generated.

I know some tasks end up happening when the kickstart is pulled on the foreman side (puppet ca cert is revoked so the new one can be signed, probably ipa otp password generated, etc.) - maybe at that same point it would make sense to delete the content host as well, or something similar?

Comment 4 Brad Buckingham 2014-08-09 13:18:04 UTC
Created redmine issue http://projects.theforeman.org/issues/7005 from this bug

Comment 5 Brad Buckingham 2014-08-09 13:30:01 UTC
Proposed fix in Katello PR:
   https://github.com/Katello/katello/pull/4555

See PR for description of the solution.

Comment 8 Tazim Kolhar 2014-08-18 09:29:28 UTC
VERIFIED

content-host associated with act_key can be deleted successfully

Comment 9 Bryan Kearney 2014-09-11 12:21:21 UTC
This was delivered with Satellite 6.0 which was released on 10 September 2014.