IcingaConfig: (temp) disable zones

This commit is contained in:
Thomas Gelf 2015-08-28 17:52:19 +02:00
parent e8ae1235fd
commit 9d921eece6
1 changed files with 16 additions and 4 deletions

View File

@ -200,6 +200,7 @@ class IcingaConfig
$this->db->commit(); $this->db->commit();
} catch (Exception $e) { } catch (Exception $e) {
$this->db->rollBack(); $this->db->rollBack();
throw $e;
var_dump($e->getMessage()); var_dump($e->getMessage());
} }
@ -275,6 +276,7 @@ class IcingaConfig
{ {
$class = 'Icinga\\Module\\Director\\Objects\\Icinga' . ucfirst($type); $class = 'Icinga\\Module\\Director\\Objects\\Icinga' . ucfirst($type);
$objects = $class::loadAll($this->connection); $objects = $class::loadAll($this->connection);
$file = null;
foreach ($objects as $object) { foreach ($objects as $object) {
if ($object->isTemplate()) { if ($object->isTemplate()) {
@ -294,13 +296,23 @@ class IcingaConfig
$zone = 'master'; $zone = 'master';
} }
$filename = $zone . '/' . $filename; if ($type === 'zone') {
$file = $this->configFile($filename); $filename = 'conf.d/zones';
if ($type === 'command') { continue;
$file->prepend("library \"methods\"\n\n"); } 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); $file->addObject($object);
} }
if ($file && $type === 'command') {
$file->prepend("library \"methods\"\n\n");
}
return $this; return $this;
} }