Project

General

Profile

Actions

Bug #9597

closed

FK violation when trying to delete a discovered host after provision

Added by Ori Rabin over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Discovery plugin
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

When provision on a discovered host fails there is a token created that is not deleted.
Provisioning the same host again will create a new token for that host.
Trying to delete the host after provision deletes only the second token,
to avoid leaving an orphaned token the delete fails with a FK violation error

Steps to reproduce:
1. discover a host
2. try to provision that host but don't put anything in the host edit form
3. save
4. fill in correct values to provision the host
5. save
6. try to delete the new managed host that was created

expected result: host is deleted

actual result: an error:

ERROR:  update or delete on table "hosts" violates foreign key constraint "tokens_host_id_fk" on table "tokens" 


Related issues 3 (0 open3 closed)

Related to Discovery - Bug #10365: Migration to delete duplicate tokens doesn't work when there are no managed hostsClosedOri Rabin05/05/2015Actions
Related to Foreman - Bug #10535: Tokens are created for managed hosts after validationClosedOri Rabin05/18/2015Actions
Has duplicate Foreman - Bug #9900: 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"Duplicate03/25/2015Actions
Actions

Also available in: Atom PDF