mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-23 13:54:27 +02:00
ServiceController|IcingaServiceForm: Catching NestingError for the form to load
fixes #11803
This commit is contained in:
parent
628df65fd4
commit
1a2cede13f
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Controllers;
|
namespace Icinga\Module\Director\Controllers;
|
||||||
|
|
||||||
|
use Icinga\Module\Director\Exception\NestingError;
|
||||||
use Icinga\Module\Director\Web\Controller\ObjectController;
|
use Icinga\Module\Director\Web\Controller\ObjectController;
|
||||||
use Icinga\Module\Director\Objects\IcingaService;
|
use Icinga\Module\Director\Objects\IcingaService;
|
||||||
use Icinga\Module\Director\Objects\IcingaHost;
|
use Icinga\Module\Director\Objects\IcingaHost;
|
||||||
@ -102,17 +103,20 @@ class ServiceController extends ObjectController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($object->isTemplate()
|
try {
|
||||||
&& $object->getResolvedProperty('check_command_id')
|
if ($object->isTemplate()
|
||||||
) {
|
&& $object->getResolvedProperty('check_command_id')
|
||||||
|
) {
|
||||||
$this->view->actionLinks .= ' ' . $this->view->qlink(
|
|
||||||
'Create apply-rule',
|
|
||||||
'director/service/add',
|
|
||||||
array('apply' => $object->object_name),
|
|
||||||
array('class' => 'icon-plus')
|
|
||||||
);
|
|
||||||
|
|
||||||
|
$this->view->actionLinks .= ' ' . $this->view->qlink(
|
||||||
|
'Create apply-rule',
|
||||||
|
'director/service/add',
|
||||||
|
array('apply' => $object->object_name),
|
||||||
|
array('class' => 'icon-plus')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (NestingError $nestingError) {
|
||||||
|
// ignore the error for the form
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Forms;
|
namespace Icinga\Module\Director\Forms;
|
||||||
|
|
||||||
|
use Icinga\Module\Director\Exception\NestingError;
|
||||||
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
use Icinga\Module\Director\Web\Form\DirectorObjectForm;
|
||||||
use Icinga\Module\Director\Objects\IcingaHost;
|
use Icinga\Module\Director\Objects\IcingaHost;
|
||||||
use Icinga\Module\Director\Objects\IcingaService;
|
use Icinga\Module\Director\Objects\IcingaService;
|
||||||
@ -42,8 +43,12 @@ class IcingaServiceForm extends DirectorObjectForm
|
|||||||
return $this->setupInherited();
|
return $this->setupInherited();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->isNew() && $this->host === null) {
|
try {
|
||||||
$this->host = $this->object->getResolvedRelated('host');
|
if (!$this->isNew() && $this->host === null) {
|
||||||
|
$this->host = $this->object->getResolvedRelated('host');
|
||||||
|
}
|
||||||
|
} catch(NestingError $nestingError) {
|
||||||
|
// ignore for the form to load
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->host === null) {
|
if ($this->host === null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user