BusinessProcess/Nodes: some cleanup

This commit is contained in:
Thomas Gelf 2016-11-29 11:20:54 +01:00
parent 7511d0f4c5
commit ca16f22a62
3 changed files with 6 additions and 5 deletions

View file

@ -112,7 +112,7 @@ class BpNode extends Node
); );
} }
$this->children[$name] = $node; $this->children[$name] = $node;
$this->children[] = $name; $this->childNames[] = $name;
$node->addParent($this); $node->addParent($this);
return $this; return $this;
} }

View file

@ -331,7 +331,6 @@ class BusinessProcess
// Separate "parse-logic" from "retrieve-state-logic" // Separate "parse-logic" from "retrieve-state-logic"
// Allow DB-based backend // Allow DB-based backend
// Use IcingaWeb2 Multi-Backend-Support // Use IcingaWeb2 Multi-Backend-Support
$check_results = array();
$hostFilter = array_keys($this->hosts); $hostFilter = array_keys($this->hosts);
if ($this->state_type === self::HARD_STATE) { if ($this->state_type === self::HARD_STATE) {
@ -509,8 +508,9 @@ class BusinessProcess
if ($pos !== false) { if ($pos !== false) {
$host = substr($name, 0, $pos); $host = substr($name, 0, $pos);
$service = substr($name, $pos + 1); $service = substr($name, $pos + 1);
if ($service === 'Hoststatus') { // TODO: deactivated, this scares me, test it
return $this->create($host); if (false && $service === 'Hoststatus') {
return $this->createHost($host);
} else { } else {
return $this->createService($host, $service); return $this->createService($host, $service);
} }

View file

@ -193,6 +193,7 @@ abstract class Node
) )
); );
} }
return $this->state; return $this->state;
} }
@ -297,7 +298,7 @@ abstract class Node
return static::$stateToSortStateMap[$state]; return static::$stateToSortStateMap[$state];
} }
throw new ProgrammingError('Got invalid state %s', $sort_state); throw new ProgrammingError('Got invalid state: %s', var_export($state, 1));
} }
protected function sortStateTostate($sortState) protected function sortStateTostate($sortState)