[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaConfig: allow to toggle legacy renderer

git at icinga.org git at icinga.org
Mon Aug 1 09:00:17 CEST 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Mon Aug  1 06:59:31 2016 +0000

IcingaConfig: allow to toggle legacy renderer

refs #12264

---

 library/Director/IcingaConfig/IcingaConfig.php |    3 ++-
 library/Director/Objects/IcingaObject.php      |    4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/library/Director/IcingaConfig/IcingaConfig.php b/library/Director/IcingaConfig/IcingaConfig.php
index 87651ee..4c810fe 100644
--- a/library/Director/IcingaConfig/IcingaConfig.php
+++ b/library/Director/IcingaConfig/IcingaConfig.php
@@ -35,7 +35,7 @@ class IcingaConfig
 
     protected $generationTime;
 
-    protected $configFormat = 'v2';
+    protected $configFormat;
 
     public static $table = 'director_generated_config';
 
@@ -46,6 +46,7 @@ class IcingaConfig
 
         $this->connection = $connection;
         $this->db = $connection->getDbAdapter();
+        $this->configFormat = $this->connection->getSetting('config_format', 'v2');
     }
 
     public function getSize()
diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php
index b47b43a..9034b95 100644
--- a/library/Director/Objects/IcingaObject.php
+++ b/library/Director/Objects/IcingaObject.php
@@ -1151,6 +1151,10 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
 
     public function renderToConfig(IcingaConfig $config)
     {
+        if ($config->isLegacy()) {
+            return $this->renderToLegacyConfig($config);
+        }
+
         if ($this->isExternal()) {
             return;
         }



More information about the icinga-checkins mailing list