Skip to content

Commit

Permalink
ProcessCommand: Fix false positive condition for ServiceNode (#445)
Browse files Browse the repository at this point in the history
fixes #440
  • Loading branch information
sukhwinder33445 authored Apr 19, 2024
1 parent c295128 commit b672c28
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions application/clicommands/ProcessCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Icinga\Module\Businessprocess\HostNode;
use Icinga\Module\Businessprocess\Node;
use Icinga\Module\Businessprocess\ProvidedHook\Icingadb\IcingadbSupport;
use Icinga\Module\Businessprocess\ServiceNode;
use Icinga\Module\Businessprocess\State\IcingaDbState;
use Icinga\Module\Businessprocess\State\MonitoringState;
use Icinga\Module\Businessprocess\Storage\LegacyStorage;
Expand Down Expand Up @@ -192,14 +193,15 @@ protected function renderProblemTree($tree, $useColors = false, $depth = 0, BpNo
$node = $subtree['node'];
$state = $parent !== null ? $parent->getChildState($node) : $node->getState();

$colors = [];
if ($node instanceof HostNode) {
$colors = $this->hostColors[$state];
} else {
} elseif ($node instanceof ServiceNode) {
$colors = $this->serviceColors[$state];
}

$state = sprintf('[%s]', $node->getStateName($state));
if ($useColors) {
if ($useColors && ! empty($colors)) {
$state = $this->screen->colorize($state, $colors[0], $colors[1]);
}

Expand Down

0 comments on commit b672c28

Please sign in to comment.