[icinga-checkins] icinga.org: icingaweb2-module-director/master: IcingaObjectImports: fix adding objects

git at icinga.org git at icinga.org
Thu Jun 16 22:43:32 CEST 2016


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

Author: Thomas Gelf <thomas at gelf.net>
Date:   Thu Jun 16 21:20:11 2016 +0200

IcingaObjectImports: fix adding objects

---

 library/Director/Objects/IcingaObjectImports.php |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/library/Director/Objects/IcingaObjectImports.php b/library/Director/Objects/IcingaObjectImports.php
index ebbbddc..87a0f37 100644
--- a/library/Director/Objects/IcingaObjectImports.php
+++ b/library/Director/Objects/IcingaObjectImports.php
@@ -175,14 +175,18 @@ class IcingaObjectImports implements Iterator, Countable, IcingaConfigRenderer
             return $this;
         }
 
-        if (array_key_exists($import, $this->imports)) {
-            return $this;
-        }
-
         if ($import instanceof $class) {
+            if (array_key_exists($import->object_name, $this->imports)) {
+                return $this;
+            }
+
             $this->imports[$import->object_name] = $import->object_name;
             $this->objects[$import->object_name] = $import;
         } elseif (is_string($import)) {
+            if (array_key_exists($import, $this->imports)) {
+                return $this;
+            }
+
             $this->imports[$import] = $import;
         }
 



More information about the icinga-checkins mailing list