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):
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
Can't delete the host without error
Host should delete as expected
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;
foreman=# delete from katello_systems where id = 11;
foreman=# delete from hosts where id = 7;
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.
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?
Created redmine issue http://projects.theforeman.org/issues/7005 from this bug
Proposed fix in Katello PR:
See PR for description of the solution.
content-host associated with act_key can be deleted successfully
This was delivered with Satellite 6.0 which was released on 10 September 2014.