IcingaService: single objects should respect...
...their host's zone where not overriden by a service template fixes #11988
This commit is contained in:
parent
82c5b10eef
commit
df36071c9c
|
@ -3,6 +3,7 @@
|
||||||
namespace Icinga\Module\Director\Objects;
|
namespace Icinga\Module\Director\Objects;
|
||||||
|
|
||||||
use Icinga\Exception\ProgrammingError;
|
use Icinga\Exception\ProgrammingError;
|
||||||
|
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
|
||||||
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
||||||
|
|
||||||
class IcingaService extends IcingaObject
|
class IcingaService extends IcingaObject
|
||||||
|
@ -232,4 +233,21 @@ class IcingaService extends IcingaObject
|
||||||
return parent::getOnDeleteUrl();
|
return parent::getOnDeleteUrl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getRenderingZone(IcingaConfig $config = null)
|
||||||
|
{
|
||||||
|
if ($this->prefersGlobalZone()) {
|
||||||
|
return $this->connection->getDefaultGlobalZoneName();
|
||||||
|
}
|
||||||
|
|
||||||
|
$zone = parent::getRenderingZone($config);
|
||||||
|
|
||||||
|
// if bound to a host, and zone is fallback to master
|
||||||
|
if ($this->host_id !== null && $zone === $this->connection->getMasterZoneName()) {
|
||||||
|
/** @var IcingaHost $host */
|
||||||
|
$host = $this->getRelatedObject('host', $this->host_id);
|
||||||
|
return $host->getRenderingZone($config);
|
||||||
|
}
|
||||||
|
return $zone;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue