IcingaZone: delegate rendering responsibility

This commit is contained in:
Thomas Gelf 2016-05-02 10:22:22 +02:00
parent 8dda8a6a9a
commit bd937e57c5
1 changed files with 16 additions and 0 deletions

View File

@ -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;