2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-01 00:57:37 +00:00

Add support for passing in "boolean" values in the openbmc REST

interfaces.  Perl doesn't really support this so pass in "true/false"
as strings and we will create the JSON data object without quotes
This commit is contained in:
Victor Hu
2017-07-13 16:13:59 -04:00
parent 469fc29013
commit 2523fafe0a

View File

@@ -945,7 +945,12 @@ sub gen_send_request {
}
if ($status_info{ $node_info{$node}{cur_status} }{data}) {
$content = '{"data":"' . $status_info{ $node_info{$node}{cur_status} }{data} . '"}';
# Handle boolean values by create the json objects without wrapping with quotes
if ($status_info{ $node_info{$node}{cur_status} }{data} =~ /^1$|^true$|^True$|^0$|^false$|^False$/) {
$content = '{"data":' . $status_info{ $node_info{$node}{cur_status} }{data} . '}';
} else {
$content = '{"data":"' . $status_info{ $node_info{$node}{cur_status} }{data} . '"}';
}
}
if ($node_info{$node}{cur_url}) {