HostgroupRestriction: do not fail on hosts w/o ID

This commit is contained in:
Thomas Gelf 2021-10-05 22:32:30 +02:00
parent 70c0b8f247
commit b12d50a16a

View File

@ -56,7 +56,8 @@ class HostgroupRestriction extends ObjectRestriction
return true;
}
if (! $host->hasBeenLoadedFromDb() || $host->hasModifiedGroups()) {
// Hint: branched hosts have no id
if (! $host->hasBeenLoadedFromDb() || $host->hasModifiedGroups() || $host->get('id') === null) {
foreach ($this->listRestrictedHostgroups() as $group) {
if ($host->hasGroup($group)) {
return true;