IcingaObject: do not fail when rendering objects...

...without imports support

fixes #12618
This commit is contained in:
Thomas Gelf 2016-10-13 11:11:35 +00:00
parent 1a2cede13f
commit c1afda4392
1 changed files with 15 additions and 6 deletions

View File

@ -1412,6 +1412,14 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
return $this->zone;
}
if ($this->hasProperty('zone_id')) {
if (! $this->supportsImports()) {
if ($zoneId = $this->zone_id) {
// Config has a lookup cache, is faster:
return $config->getZoneName($zoneId);
}
}
try {
if ($zoneId = $this->getResolvedProperty('zone_id')) {
// Config has a lookup cache, is faster:
@ -1420,6 +1428,7 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
} catch (Exception $e) {
return self::RESOLVE_ERROR;
}
}
if ($this->prefersGlobalZone()) {
return $this->connection->getDefaultGlobalZoneName();