From bd937e57c5d472e50628a524a04062b4bd727816 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Mon, 2 May 2016 10:22:22 +0200 Subject: [PATCH] IcingaZone: delegate rendering responsibility --- library/Director/Objects/IcingaZone.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/library/Director/Objects/IcingaZone.php b/library/Director/Objects/IcingaZone.php index ea05b8db..4fe0688b 100644 --- a/library/Director/Objects/IcingaZone.php +++ b/library/Director/Objects/IcingaZone.php @@ -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;