diff --git a/storage/hp/p2000/xmlapi/custom.pm b/storage/hp/p2000/xmlapi/custom.pm index 1ebfc7798..90d523a32 100644 --- a/storage/hp/p2000/xmlapi/custom.pm +++ b/storage/hp/p2000/xmlapi/custom.pm @@ -202,6 +202,27 @@ sub get_infos { $self->{output}->option_exit(); } + # Check if there is an error + # + #Error + #1 + #The command is ambiguous. Please check the help for this command. + #-10028 + # + # + if (my $nodestatus = $xpath->find("//OBJECT[\@basetype='status']//PROPERTY[\@name='return-code']")) { + my @nodes = $nodestatus->get_nodelist(); + my $node = shift @nodes; + my $return_code = $node->string_value; + if ($return_code != 0) { + $nodestatus = $xpath->find("//OBJECT[\@basetype='status']//PROPERTY[\@name='response']"); + @nodes = $nodestatus->get_nodelist(); + $node = shift @nodes; + $self->{output}->add_option_msg(short_msg => $node->string_value); + $self->{output}->option_exit(); + } + } + my $results = {}; foreach my $node ($nodeset->get_nodelist()) { my $properties = {}; diff --git a/storage/hp/p2000/xmlapi/mode/components/sensors.pm b/storage/hp/p2000/xmlapi/mode/components/sensors.pm index a31380fea..42520f6ce 100644 --- a/storage/hp/p2000/xmlapi/mode/components/sensors.pm +++ b/storage/hp/p2000/xmlapi/mode/components/sensors.pm @@ -67,7 +67,7 @@ sub check { my ($value, $unit); ($value, $unit) = ($1, $2) if ($results->{$sensor_id}->{value} =~ /\s*([0-9\.,]+)\s*(\S*)\s*/); - if (defined($sensor_type{$results->{$sensor_id}->{'sensor-type'}})) { + if (defined($results->{$sensor_id}->{'sensor-type'}) && defined($sensor_type{$results->{$sensor_id}->{'sensor-type'}})) { $unit = $sensor_type{$results->{$sensor_id}->{'sensor-type'}}->{unit}; }