[icinga-checkins] icinga.org: icingaweb2-module-director/feature/field-loader-12904: HostController: catch NestingError when...

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


Module: icingaweb2-module-director
Branch: feature/field-loader-12904
Commit: 628df65fd45e6f22985db63e23030e78f4ea6d98
URL:    https://git.icinga.org/?p=icingaweb2-module-director.git;a=commit;h=628df65fd45e6f22985db63e23030e78f4ea6d98

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

HostController: catch NestingError when...

...resolving agent property

refs #11803

---

 application/controllers/HostController.php |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/application/controllers/HostController.php b/application/controllers/HostController.php
index 461309a..31318a6 100644
--- a/application/controllers/HostController.php
+++ b/application/controllers/HostController.php
@@ -4,6 +4,7 @@ namespace Icinga\Module\Director\Controllers;
 
 use Exception;
 use Icinga\Exception\NotFoundError;
+use Icinga\Module\Director\Exception\NestingError;
 use Icinga\Module\Director\IcingaConfig\AgentWizard;
 use Icinga\Module\Director\Objects\IcingaEndpoint;
 use Icinga\Module\Director\Objects\IcingaHost;
@@ -24,14 +25,18 @@ class HostController extends ObjectController
                 'urlParams' => array('name' => $this->object->object_name),
                 'label'     => 'Services'
             ));
-            if ($this->object->object_type === 'object'
-                && $this->object->getResolvedProperty('has_agent') === 'y'
-            ) {
-                $tabs->add('agent', array(
-                    'url'       => 'director/host/agent',
-                    'urlParams' => array('name' => $this->object->object_name),
-                    'label'     => 'Agent'
-                ));
+            try {
+                if ($this->object->object_type === 'object'
+                    && $this->object->getResolvedProperty('has_agent') === 'y'
+                ) {
+                    $tabs->add('agent', array(
+                        'url'       => 'director/host/agent',
+                        'urlParams' => array('name' => $this->object->object_name),
+                        'label'     => 'Agent'
+                    ));
+                }
+            } catch (NestingError $e) {
+                // Ignore nesting errors
             }
         }
     }



More information about the icinga-checkins mailing list