From 9d921eece6c4744d1c6352445cbbfa42e58e91b9 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 28 Aug 2015 17:52:19 +0200 Subject: [PATCH] IcingaConfig: (temp) disable zones --- .../Director/IcingaConfig/IcingaConfig.php | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/library/Director/IcingaConfig/IcingaConfig.php b/library/Director/IcingaConfig/IcingaConfig.php index 927c9381..340078ca 100644 --- a/library/Director/IcingaConfig/IcingaConfig.php +++ b/library/Director/IcingaConfig/IcingaConfig.php @@ -200,6 +200,7 @@ class IcingaConfig $this->db->commit(); } catch (Exception $e) { $this->db->rollBack(); +throw $e; var_dump($e->getMessage()); } @@ -275,6 +276,7 @@ class IcingaConfig { $class = 'Icinga\\Module\\Director\\Objects\\Icinga' . ucfirst($type); $objects = $class::loadAll($this->connection); + $file = null; foreach ($objects as $object) { if ($object->isTemplate()) { @@ -294,13 +296,23 @@ class IcingaConfig $zone = 'master'; } - $filename = $zone . '/' . $filename; - $file = $this->configFile($filename); - if ($type === 'command') { - $file->prepend("library \"methods\"\n\n"); + if ($type === 'zone') { + $filename = 'conf.d/zones'; +continue; + } elseif ($type === 'endpoint') { + $filename = 'conf.d/endpoints'; +continue; + } elseif ($zone === 'master') { + $filename = 'conf.d/' . $filename; + } else { + $filename = 'zones.d/' . $zone . '/' . $filename; } + $file = $this->configFile($filename); $file->addObject($object); } + if ($file && $type === 'command') { + $file->prepend("library \"methods\"\n\n"); + } return $this; }