Skip to content

Commit

Permalink
Fix: Switching to the icingadb backend and searching host/service nod…
Browse files Browse the repository at this point in the history
…e in add/edit form throws an error

`HostServiceTermValidator`: `$testConfig` requires backend for `MonitoringState::apply()` call.

If the `$testConfig` has no backend set and icingadb is in use, `MonitoringState::__construct($config) => $config->getBackend()` returns an icingadb backend that is not suitable for the `MonitoringState` class.
  • Loading branch information
sukhwinder33445 committed Mar 27, 2024
1 parent 4428d78 commit f4d704f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public function isValid($terms)
}

$isValid = true;
$testConfig = new BpConfig();
$testConfig = (new BpConfig())
->setBackend($this->parent->getBpConfig()->getBackend());

foreach ($terms as $term) {
/** @var Term $term */
Expand All @@ -68,7 +69,7 @@ public function isValid($terms)
}
}

if ($this->parent->getBpConfig()->getBackend() instanceof MonitoringBackend) {
if ($testConfig->getBackend() instanceof MonitoringBackend) {
MonitoringState::apply($testConfig);
} else {
IcingaDbState::apply($testConfig);
Expand Down

0 comments on commit f4d704f

Please sign in to comment.