(plugin) storage::hp::p2000::xmlapi - mode health fix Not an ARRAY reference (#3936)

This commit is contained in:
qgarnier 2022-09-29 17:22:31 +02:00 committed by GitHub
parent 96a6ad5e39
commit 068ffd8abc
5 changed files with 10 additions and 6 deletions

View File

@ -219,7 +219,7 @@ sub get_infos {
}
if ($return_code != 0) {
return ({}, 0) if (defined($options{no_quit}) && $options{no_quit} == 1);
return (!defined($options{key}) ? [] : {}, 0) if (defined($options{no_quit}) && $options{no_quit} == 1);
$self->{output}->add_option_msg(short_msg => $response);
$self->{output}->option_exit();
}

View File

@ -31,12 +31,13 @@ sub check {
$self->{components}->{fan} = { name => 'fan', total => 0, skip => 0 };
return if ($self->check_filter(section => 'fan'));
my ($entries) = $self->{custom}->get_infos(
my ($entries, $rv) = $self->{custom}->get_infos(
cmd => 'show fans',
base_type => 'fan',
properties_name => '^health-numeric|location|durable-id|speed$',
no_quit => 1
);
return if ($rv == 0);
my ($results, $duplicated) = ({}, {});
foreach (@$entries) {

View File

@ -30,12 +30,13 @@ sub check {
$self->{components}->{fru} = {name => 'frus', total => 0, skip => 0};
return if ($self->check_filter(section => 'fru'));
my ($entries) = $self->{custom}->get_infos(
my ($entries, $rv) = $self->{custom}->get_infos(
cmd => 'show frus',
base_type => 'enclosure-fru',
properties_name => '^fru-status|fru-location|oid$',
no_quit => 1,
no_quit => 1
);
return if ($rv == 0);
my ($results, $duplicated) = ({}, {});
foreach (@$entries) {

View File

@ -31,12 +31,13 @@ sub check {
$self->{components}->{psu} = { name => 'psu', total => 0, skip => 0 };
return if ($self->check_filter(section => 'psu'));
my ($entries) = $self->{custom}->get_infos(
my ($entries, $rv) = $self->{custom}->get_infos(
cmd => 'show power-supplies',
base_type => 'power-supplies',
properties_name => '^durable-id|health-numeric|name$',
no_quit => 1
);
return if ($rv == 0);
my ($results, $duplicated) = ({}, {});
foreach (@$entries) {

View File

@ -44,11 +44,12 @@ sub check {
return if ($self->check_filter(section => 'sensor'));
# We don't use status-numeric. Values are buggy !!!???
my ($entries) = $self->{custom}->get_infos(
my ($entries, $rv) = $self->{custom}->get_infos(
cmd => 'show sensor-status',
base_type => 'sensors',
properties_name => '^(?:sensor-name|value|sensor-type|status|enclosure-id)$'
);
return if ($rv == 0);
my ($results, $duplicated) = ({}, {});
foreach (@$entries) {