[icinga-checkins] icinga.org: icingaweb2-module-director/master: HostController: no loop check for 'fake' services

git at icinga.org git at icinga.org
Thu Oct 20 03:16:01 CEST 2016


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

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

HostController: no loop check for 'fake' services

Inherited services do not exist in the db. As many services would
carry their template's name, the fallback to a name-based loop check
would trigger an erraneous error. So we trigger no preliminary loop
check for those now.

fixes #12938

---

 application/controllers/HostController.php       |    6 +++---
 library/Director/Web/Form/DirectorObjectForm.php |   11 ++++++++---
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/application/controllers/HostController.php b/application/controllers/HostController.php
index 31318a6..997b46d 100644
--- a/application/controllers/HostController.php
+++ b/application/controllers/HostController.php
@@ -218,9 +218,9 @@ class HostController extends ObjectController
             ->setDb($db)
             ->setHost($host)
             ->setInheritedFrom($from->object_name)
-            ->setObject($service)
-            ->handleRequest()
-            ;
+            ->setObject($service);
+        $this->view->form->setResolvedImports();
+        $this->view->form->handleRequest();
 
         $this->setViewScript('object/form');
     }
diff --git a/library/Director/Web/Form/DirectorObjectForm.php b/library/Director/Web/Form/DirectorObjectForm.php
index 08eb245..8241e61 100644
--- a/library/Director/Web/Form/DirectorObjectForm.php
+++ b/library/Director/Web/Form/DirectorObjectForm.php
@@ -76,10 +76,10 @@ abstract class DirectorObjectForm extends QuickForm
         $object = $this->object;
 
         if (! $object instanceof IcingaObject) {
-            return $this->resolvedImports = false;
+            return $this->setResolvedImports(false);
         }
         if (! $object->supportsImports()) {
-            return $this->resolvedImports = false;
+            return $this->setResolvedImports(false);
         }
 
         if ($this->hasBeenSent()) {
@@ -99,7 +99,12 @@ abstract class DirectorObjectForm extends QuickForm
             return $this->resolvedImports = false;
         }
 
-        return $this->resolvedImports = true;
+        return $this->setResolvedImports();
+    }
+
+    public function setResolvedImports($resolved = true)
+    {
+        return $this->resolvedImports = $resolved;
     }
 
     public function isObject()



More information about the icinga-checkins mailing list