mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 00:04:05 +02:00
IcingaObject: getRenderingZone() must succeed...
...even when no config is given refs #1394
This commit is contained in:
parent
56f44b9ff1
commit
41e379b008
@ -1586,15 +1586,30 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||||||
if ($this->hasProperty('zone_id')) {
|
if ($this->hasProperty('zone_id')) {
|
||||||
if (! $this->supportsImports()) {
|
if (! $this->supportsImports()) {
|
||||||
if ($zoneId = $this->get('zone_id')) {
|
if ($zoneId = $this->get('zone_id')) {
|
||||||
// Config has a lookup cache, is faster:
|
// TODO: this is ugly.
|
||||||
return $config->getZoneName($zoneId);
|
if ($config === null) {
|
||||||
|
return IcingaZone::loadWithAutoIncId(
|
||||||
|
$zoneId,
|
||||||
|
$this->getConnection()
|
||||||
|
)->getObjectName();
|
||||||
|
} else {
|
||||||
|
// Config has a lookup cache, is faster:
|
||||||
|
return $config->getZoneName($zoneId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($zoneId = $this->getSingleResolvedProperty('zone_id')) {
|
if ($zoneId = $this->getSingleResolvedProperty('zone_id')) {
|
||||||
// Config has a lookup cache, is faster:
|
if ($config === null) {
|
||||||
return $config->getZoneName($zoneId);
|
return IcingaZone::loadWithAutoIncId(
|
||||||
|
$zoneId,
|
||||||
|
$this->getConnection()
|
||||||
|
)->getObjectName();
|
||||||
|
} else {
|
||||||
|
// Config has a lookup cache, is faster:
|
||||||
|
return $config->getZoneName($zoneId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return self::RESOLVE_ERROR;
|
return self::RESOLVE_ERROR;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user