#6 Deleting a host does not clean out hostgroups

open
nobody
None
5
2006-10-04
2006-10-04
Anonymous
No

This is a bug (as opposed to a feature request) because
it created invalid Nagios configuration files when it
happens. Not to mention making the hostgroup_members
table inconsistant with the hosts table.

BUG:
When a host is deleted, its host_id information remains
in the hostgroup_members table.

RESULTING ERROR:
This causes an mysql index error to occur at line 350
in createtxt.php when writing the config files. It will
also fill the servicegroup.cfg with NULL entries for
each deleted host, causing the Nagios configuration
check to fail.

FIX:
132c132
< $hostgroupmembersdeletequery =
mysql_query("DELETE FROM hostgroup_members WHERE
hostgroup_id='$hostgroup_id'");
---
> $hostgroupmembersdeletequery =
mysql_query("DELETE FROM hostgroup_members WHERE
host_id='$host_id'");

Discussion