2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 03:32:04 +00:00

Merge pull request #4779 from whowutwut/power_supply_sensor_Fix

Handle the PowerSupplyRedundancy Sensor API issue where Value is lower case
This commit is contained in:
xuweibj 2018-02-02 08:32:04 +08:00 committed by GitHub
commit 795b09282a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
}
}