[icinga-checkins] icinga.org: icingaweb2-module-director/feature/service-set-12891: IcingaObject: new helper method for single...

git at icinga.org git at icinga.org
Thu Oct 20 09:26:58 CEST 2016


Module: icingaweb2-module-director
Branch: feature/service-set-12891
Commit: fc2890d8654b51883220a8f3a7df39acb66469a9
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=fc2890d8654b51883220a8f3a7df39acb66469a9

Author: Thomas Gelf <thomas at gelf.net>
Date:   Thu Oct 20 01:37:23 2016 +0000

IcingaObject: new helper method for single...

...resolved custom vars

---

 library/Director/Objects/IcingaObject.php |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php
index e366d17..616a1f9 100644
--- a/library/Director/Objects/IcingaObject.php
+++ b/library/Director/Objects/IcingaObject.php
@@ -832,6 +832,21 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
         }
     }
 
+    public function getResolvedVar($varname)
+    {
+        try {
+            $vars = $this->getResolvedVars();
+        } catch (NestingError $e) {
+            return null;
+        }
+
+        if (property_exists($vars, $varname)) {
+            return $vars->$varname;
+        } else {
+            return null;
+        }
+    }
+
     public function getOriginForVar($varname)
     {
         try {



More information about the icinga-checkins mailing list