2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 09:13:08 +00:00

Handle the PowerSupplyRedundancy API issue where Value is lower case

This commit is contained in:
Victor Hu 2018-02-01 15:59:03 -05:00
parent 1cf4d75612
commit 5edae8d52e

View File

@ -4076,11 +4076,19 @@ sub rvitals_response {
# Calculate the adjusted value based on the scale attribute
#
$calc_value = $content{Value};
if ( $content{Scale} != 0 ) {
if (!defined($calc_value)) {
# Handle the bug where the keyword in the API is lower case value
$calc_value = $content{value};
}
if (defined $content{Scale} and $content{Scale} != 0) {
$calc_value = ($content{Value} * (10 ** $content{Scale}));
}
$content_info = $label . ": " . $calc_value . " " . $sensor_units{ $content{Unit} };
$content_info = $label . ": " . $calc_value;
if (defined($content{Unit})) {
$content_info = $content_info . " " . $sensor_units{ $content{Unit} };
}
push (@sorted_output, $content_info); #Save output in array
}
}