[icinga-checkins] icinga.org: icingaweb2-module-director/master: ActionController: Add load helper for IcingaConfig

git at icinga.org git at icinga.org
Thu Nov 3 14:23:26 CET 2016


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

Author: Markus Frosch <markus.frosch at icinga.com>
Date:   Wed Oct 19 10:30:34 2016 +0200

ActionController: Add load helper for IcingaConfig

---

 library/Director/Web/Controller/ActionController.php |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/library/Director/Web/Controller/ActionController.php b/library/Director/Web/Controller/ActionController.php
index 751ee10..6d03343 100644
--- a/library/Director/Web/Controller/ActionController.php
+++ b/library/Director/Web/Controller/ActionController.php
@@ -8,6 +8,7 @@ use Icinga\Exception\ConfigurationError;
 use Icinga\Exception\NotFoundError;
 use Icinga\Module\Director\Core\CoreApi;
 use Icinga\Module\Director\Db;
+use Icinga\Module\Director\IcingaConfig\IcingaConfig;
 use Icinga\Module\Director\Monitoring;
 use Icinga\Module\Director\Objects\IcingaEndpoint;
 use Icinga\Module\Director\Web\Form\FormLoader;
@@ -31,6 +32,8 @@ abstract class ActionController extends Controller
     /** @var Monitoring */
     private $monitoring;
 
+    protected $icingaConfig;
+
     public function init()
     {
         if ($this->getRequest()->isApiRequest()) {
@@ -305,4 +308,12 @@ abstract class ActionController extends Controller
 
         return $this->monitoring;
     }
+
+    protected function IcingaConfig() {
+        if ($this->icingaConfig === null) {
+            $this->icingaConfig = new IcingaConfig($this->db);
+        }
+
+        return $this->icingaConfig;
+    }
 }



More information about the icinga-checkins mailing list