[icinga-checkins] icinga.org: icingaweb2-module-director/feature/scheduled-downtimes-12138: ShowController: let the object provide the config

git at icinga.org git at icinga.org
Thu Oct 13 13:48:46 CEST 2016


Module: icingaweb2-module-director
Branch: feature/scheduled-downtimes-12138
Commit: 18882324ee1ef4abfe2aed6180c68d849871bbe9
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=18882324ee1ef4abfe2aed6180c68d849871bbe9

Author: Thomas Gelf <thomas at gelf.net>
Date:   Thu Oct 13 09:20:39 2016 +0000

ShowController: let the object provide the config

---

 application/controllers/ShowController.php |   25 ++-----------------------
 1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/application/controllers/ShowController.php b/application/controllers/ShowController.php
index 87e6ce7..87f62c8 100644
--- a/application/controllers/ShowController.php
+++ b/application/controllers/ShowController.php
@@ -75,35 +75,14 @@ class ShowController extends ActionController
         return $tabs;
     }
 
-    protected function getObjectConfig($object)
-    {
-        $config = new IcingaConfig($this->db());
-        if ($object->isExternal()) {
-            $object->object_type = 'object';
-        }
-
-        try {
-            $object->renderToConfig($config);
-        } catch (Exception $e) {
-            $config->configFile(
-                'failed-to-render'
-            )->prepend(
-                "/** Failed to render this object **/\n"
-                . '/*  ' . $e->getMessage() . ' */'
-            );
-        }
-
-        return $config;
-    }
-
     protected function newConfig($entry)
     {
-        return $this->getObjectConfig($this->newObject($entry));
+        return $this->newObject($entry)->toSingleIcingaConfig();
     }
 
     protected function oldConfig($entry)
     {
-        return $this->getObjectConfig($this->oldObject($entry));
+        return $this->oldObject($entry)->toSingleIcingaConfig();
     }
 
     protected function showDiff($entry)



More information about the icinga-checkins mailing list