No matter if the state is in lowercase or uppercase reported by vcenters it should work.
Current Behavior
if vCener send state in lowercase (dont ask me why) the check fails with unkown state
icingaweb2:~ $ '/usr/bin/icingacli' 'vspheredb' 'check' 'vcenterconnection' '--name' 'myvecnter.fqdn' '--vCenter' '666'
[UNKNOWN] warning is not a valid state name
Possible Solution
add $state = strtoupper($state); to the function wantNumericState
protected function wantNumericState($state)
{
$state = strtoupper($state);
if (is_int($state) || ctype_digit($state)) {
if (array_key_exists($state, $this->stateNameMap)) {
return (int) $state;
} else {
throw new InvalidArgumentException(sprintf('%d is not a valid numeric state', $state));
}
} else {
if (array_key_exists($state, $this->nameStateMap)) {
return $this->nameStateMap[$state];
} else {
throw new InvalidArgumentException(sprintf('%s is not a valid state name', $state));
}
}
}
Expected Behavior
No matter if the state is in lowercase or uppercase reported by vcenters it should work.
Current Behavior
if vCener send state in lowercase (dont ask me why) the check fails with unkown state
Possible Solution
add
$state = strtoupper($state);
to the function wantNumericStateSteps to Reproduce (for bugs)
Happens on some vecenter connection tests.
Your Environment