IcingaZone: delegate rendering responsibility
This commit is contained in:
parent
8dda8a6a9a
commit
bd937e57c5
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Icinga\Module\Director\Objects;
|
||||
|
||||
use Icinga\Module\Director\IcingaConfig\IcingaConfig;
|
||||
use Icinga\Module\Director\IcingaConfig\IcingaConfigHelper as c;
|
||||
|
||||
class IcingaZone extends IcingaObject
|
||||
|
@ -40,6 +41,21 @@ class IcingaZone extends IcingaObject
|
|||
return c::renderKeyValue('endpoints', c::renderArray($endpoints));
|
||||
}
|
||||
|
||||
public function getRenderingZone(IcingaConfig $config = null)
|
||||
{
|
||||
// If the zone has a parent zone...
|
||||
if ($this->get('parent_id')) {
|
||||
// ...we render the zone object to the parent zone
|
||||
return $this->parent;
|
||||
} elseif ($this->is_global === 'y') {
|
||||
// ...additional global zones are rendered to our global zone...
|
||||
return $this->connection->getDefaultGlobalZoneName();
|
||||
} else {
|
||||
// ...and all the other zones are rendered to our master zone
|
||||
return $this->connection->getMasterZoneName();
|
||||
}
|
||||
}
|
||||
|
||||
public function setEndpointList($list)
|
||||
{
|
||||
$this->endpointList = $list;
|
||||
|
|
Loading…
Reference in New Issue