IcingaServiceForm: fix "blacklist" for overrides

...when defined being such via Sync rule
This commit is contained in:
Thomas Gelf 2018-06-05 11:05:43 +02:00
parent ee230cb865
commit bd5ad64f02
1 changed files with 15 additions and 8 deletions

View File

@ -51,6 +51,10 @@ class IcingaServiceForm extends DirectorObjectForm
*/
public function setup()
{
if (!$this->isNew() || $this->providesOverrides()) {
$this->tryToFetchHost();
}
if ($this->providesOverrides()) {
return;
}
@ -60,14 +64,6 @@ class IcingaServiceForm extends DirectorObjectForm
return;
}
try {
if (!$this->isNew() && $this->host === null) {
$this->host = $this->object->getResolvedRelated('host');
}
} catch (NestingError $nestingError) {
// ignore for the form to load
}
if ($this->set !== null) {
$this->setupSetRelatedElements();
} elseif ($this->host === null) {
@ -77,6 +73,17 @@ class IcingaServiceForm extends DirectorObjectForm
}
}
protected function tryToFetchHost()
{
try {
if ($this->host === null) {
$this->host = $this->object->getResolvedRelated('host');
}
} catch (NestingError $nestingError) {
// ignore for the form to load
}
}
protected function providesOverrides()
{
return $this->applyGenerated