From 7dfadf1951af56a5b9bb3f230b5a8e3ea232b458 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 26 May 2016 01:36:20 +0200 Subject: [PATCH] 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 58414130..e4118198 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);