From 5edae8d52e7ff20d500efffe233d830ede335fbf Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 1 Feb 2018 15:59:03 -0500 Subject: [PATCH] Handle the PowerSupplyRedundancy API issue where Value is lower case --- xCAT-server/lib/xcat/plugins/openbmc.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 1da7cef1a..742ad78f8 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -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 } }