From 029ee84d33dee846e5ace57c67e01b88daa7bde8 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Mon, 30 Nov 2015 15:31:54 +0100 Subject: [PATCH] IcingaConfig: cleanup, hardcode director-global --- library/Director/IcingaConfig/IcingaConfig.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/Director/IcingaConfig/IcingaConfig.php b/library/Director/IcingaConfig/IcingaConfig.php index be5acd0e..40367a7b 100644 --- a/library/Director/IcingaConfig/IcingaConfig.php +++ b/library/Director/IcingaConfig/IcingaConfig.php @@ -175,6 +175,7 @@ class IcingaConfig ->where('checksum IN (?)', array_map(array($this, 'dbBin'), $this->getFilesChecksums())); $existing = $this->db->fetchCol($existingQuery); + foreach ($existing as $key => $val) { if (is_resource($val)) { $existing[$key] = stream_get_contents($val); @@ -189,6 +190,7 @@ class IcingaConfig if (! in_array($checksum, $missing)) { continue; } + $this->db->insert( $fileTable, array( @@ -206,7 +208,6 @@ class IcingaConfig 'checksum' => $this->dbBin($this->getChecksum()), ) ); - /** @var IcingaConfigFile $file */ foreach ($this->files as $name => $file) { $this->db->insert( @@ -235,6 +236,8 @@ throw $e; $this->configFile('conf.d/001-director-basics.conf')->prepend( "\nconst DirectorStageDir = dirname(dirname(current_filename))\n" + . "\nobject Zone \"director-global\" {\n global = true\n}\n" + ); $this @@ -302,6 +305,7 @@ throw $e; { $class = 'Icinga\\Module\\Director\\Objects\\Icinga' . ucfirst($type); $objects = $class::loadAll($this->connection); + if (empty($objects)) return $this; $ourGlobalZone = 'director-global'; $file = null;