Bug #9900
closedERROR: update or delete on table "hosts" violates foreign key constraint "tokens_host_id_fk" on table "tokens" DETAIL: Key (id)=(6) is still referenced from table "tokens"
Description
This happened on a fresh install of 1.7
I was modifying the partition tables (trying different alternatives) and the host in question was being created over and over. In one of the runs, it did not allowed me to delete the host any more.
I tried re-discovering it, and now I have it added as a discovered host (macXXXXX) and also a host with the same mac. I can't reprovision the discovered host with the same name, and when I try to delete the host I am getting the tokens key error.
When looking for full trace, this is the result:
PGError
ERROR: update or delete on table "hosts" violates foreign key constraint "tokens_host_id_fk" on table "tokens" DETAIL: Key (id)=(6) is still referenced from table "tokens".
app/controllers/hosts_controller.rb:118:in `destroy'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'
Updated by Dominic Cleal over 9 years ago
- Is duplicate of Bug #9597: FK violation when trying to delete a discovered host after provision added
Updated by Dominic Cleal over 9 years ago
- Status changed from New to Duplicate
I think this is probably an issue from the Discovery plugin, it had a bug (#9597) in 2.0.0 which caused duplicate tokens to be created. 2.0.1 fixes the issue and we're pushing packages this morning to the repos - please update when it becomes available.