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
1 changed files with 13 additions and 8 deletions

View File

@ -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
}
}
}