HostController: catch NestingError when...

...resolving agent property

refs #11803
This commit is contained in:
Thomas Gelf 2016-10-13 10:05:35 +00:00
parent 18882324ee
commit 628df65fd4

View File

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