IcingaObject: getRenderingZone() must succeed...
...even when no config is given refs #1394
This commit is contained in:
parent
56f44b9ff1
commit
41e379b008
|
@ -1586,16 +1586,31 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
|
|||
if ($this->hasProperty('zone_id')) {
|
||||
if (! $this->supportsImports()) {
|
||||
if ($zoneId = $this->get('zone_id')) {
|
||||
// TODO: this is ugly.
|
||||
if ($config === null) {
|
||||
return IcingaZone::loadWithAutoIncId(
|
||||
$zoneId,
|
||||
$this->getConnection()
|
||||
)->getObjectName();
|
||||
} else {
|
||||
// Config has a lookup cache, is faster:
|
||||
return $config->getZoneName($zoneId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if ($zoneId = $this->getSingleResolvedProperty('zone_id')) {
|
||||
if ($config === null) {
|
||||
return IcingaZone::loadWithAutoIncId(
|
||||
$zoneId,
|
||||
$this->getConnection()
|
||||
)->getObjectName();
|
||||
} else {
|
||||
// Config has a lookup cache, is faster:
|
||||
return $config->getZoneName($zoneId);
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
return self::RESOLVE_ERROR;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue