IcingaObject: do not load resolved memberships...

...for unstored objects
This commit is contained in:
Thomas Gelf 2021-04-15 10:22:45 +02:00
parent 694cacb464
commit a2016e99c0
1 changed files with 5 additions and 0 deletions

View File

@ -866,6 +866,11 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
if (! $this instanceof IcingaHost) {
throw new RuntimeException('getAppliedGroups is only available for hosts currently!');
}
if (! $this->hasBeenLoadedFromDb()) {
// There are no stored related/resolved groups. We'll also not resolve
// them here on demand.
return [];
}
$type = strtolower($this->getType());
$query = $this->db->select()->from(