[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaObject: do not fail when rendering objects...

git at icinga.org git at icinga.org
Thu Oct 13 13:12:12 CEST 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Thu Oct 13 11:11:35 2016 +0000

IcingaObject: do not fail when rendering objects...

...without imports support

fixes #12618

---

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

diff --git a/library/Director/Objects/IcingaObject.php b/library/Director/Objects/IcingaObject.php
index cba5826..6f0f0d7 100644
--- a/library/Director/Objects/IcingaObject.php
+++ b/library/Director/Objects/IcingaObject.php
@@ -1412,13 +1412,22 @@ abstract class IcingaObject extends DbObject implements IcingaConfigRenderer
             return $this->zone;
         }
 
-        try {
-            if ($zoneId = $this->getResolvedProperty('zone_id')) {
-                // Config has a lookup cache, is faster:
-                return $config->getZoneName($zoneId);
+        if ($this->hasProperty('zone_id')) {
+            if (! $this->supportsImports()) {
+                if ($zoneId = $this->zone_id) {
+                    // Config has a lookup cache, is faster:
+                    return $config->getZoneName($zoneId);
+                }
+            }
+
+            try {
+                if ($zoneId = $this->getResolvedProperty('zone_id')) {
+                    // Config has a lookup cache, is faster:
+                    return $config->getZoneName($zoneId);
+                }
+            } catch (Exception $e) {
+                return self::RESOLVE_ERROR;
             }
-        } catch (Exception $e) {
-            return self::RESOLVE_ERROR;
         }
 
         if ($this->prefersGlobalZone()) {



More information about the icinga-checkins mailing list