Trying to delete a subnet that is associated with a host group throws foreign key error
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1109315
Description of problem:
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Manually create a subnet ('mysubnet', 192.168.100.1, 255.255.255.0)
2. Associate this subnet with a hostgroup
3. Try to delete the subnet
Oops, we're sorry but something went wrong
ERROR: update or delete on table "subnets" violates foreign key constraint "hostgroups_subnet_id_fk" on table "hostgroups" DETAIL: Key (id)=(2) is still referenced from table "hostgroups".
If you feel this is an error with Foreman itself, please open a new issue with Foreman ticketing system, You would probably need to attach the Full trace and relevant log entries.
A handled exception and perhaps a UI block on trying to delete a subnet that is already associated.