[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaHost: fix parent zone for agent zone in a...

git at icinga.org git at icinga.org
Thu May 26 01:37:05 CEST 2016


Module: icingaweb2-module-director
Branch: master
Commit: 7dfadf1951af56a5b9bb3f230b5a8e3ea232b458
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=7dfadf1951af56a5b9bb3f230b5a8e3ea232b458

Author: Thomas Gelf <thomas at gelf.net>
Date:   Thu May 26 01:36:20 2016 +0200

IcingaHost: fix parent zone for agent zone in a...

...satellite zone

---

 library/Director/Objects/IcingaHost.php |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/library/Director/Objects/IcingaHost.php b/library/Director/Objects/IcingaHost.php
index 5841413..e411819 100644
--- a/library/Director/Objects/IcingaHost.php
+++ b/library/Director/Objects/IcingaHost.php
@@ -186,11 +186,17 @@ class IcingaHost extends IcingaObject
         $props['zone_id'] = $this->getResolvedProperty('zone_id');
 
         $endpoint = IcingaEndpoint::create($props);
+
         $zone = IcingaZone::create(array(
             'object_name' => $name,
-            'parent'      => $this->connection->getMasterZoneName()
         ), $this->connection)->setEndpointList(array($name));
 
+        if ($props['zone_id']) {
+            $zone->parent_id = $props['zone_id'];
+        } else {
+            $zone->parent = $this->connection->getMasterZoneName();
+        }
+
         $pre = 'zones.d/' . $this->getRenderingZone($config) . '/';
         $config->configFile($pre . 'agent_endpoints')->addObject($endpoint);
         $config->configFile($pre . 'agent_zones')->addObject($zone);



More information about the icinga-checkins mailing list