Actions
Bug #5616
closedDelete of Host fails when Reports are present
Status:
Duplicate
Priority:
High
Assignee:
-
Category:
Host creation
Target version:
-
Description
Hi, we are using foreman 1.4.2 with postgresql DB backend. When trying to delete host that has reports present I get this error:
Warning! ERROR: update or delete on table "hosts" violates foreign key constraint "reports_host_id_fk" on table "reports" DETAIL: Key (id)=(624) is still referenced from table "reports". ... PGError ERROR: update or delete on table "hosts" violates foreign key constraint "reports_host_id_fk" on table "reports" DETAIL: Key (id)=(624) is still referenced from table "reports". app/controllers/hosts_controller.rb:124:in `destroy' app/models/concerns/foreman/thread_session.rb:33:in `clear_thread' lib/middleware/catch_json_parse_errors.rb:9:in `call'
This feature was working before when host didn't recieve any report
Updated by Daniel Lobato Garcia over 10 years ago
This is a duplicate of http://projects.theforeman.org/issues/3530
This error happens because the user performing the deletion needs to have some role with the permission :destroy_reports, otherwise there would be some reports hanging around in the DB without host.
Updated by Dominic Cleal over 10 years ago
- Is duplicate of Bug #3530: Unable to destroy a host when user have permissions to "destroy_hosts" but no premissions to "destroy_reports". added
Actions