From 2e017e2c105c6f0a71eab8832137d31bf827b4a8 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 16 May 2017 15:56:49 -0400 Subject: [PATCH] OpenBMC rinv sorted output --- xCAT-server/lib/xcat/plugins/openbmc.pm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 4f0663d41..6014eb72b 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -876,6 +876,7 @@ sub rinv_response { my $grep_string = $status_info{RINV_RESPONSE}{argv}; my $src; my $content_info; + my @sorted_output; foreach my $key_url (keys %{$response_info->{data}}) { my %content = %{ ${ $response_info->{data} }{$key_url} }; @@ -893,19 +894,23 @@ sub rinv_response { } if (($grep_string eq "vpd" or $grep_string eq "mprom")) { - # wait for interface + xCAT::SvrUtils::sendmsg("No information can be obtained for $grep_string", $callback, $node); + last; } if (($grep_string eq "vpd" or $grep_string eq "deviceid")) { - # wait for interface + xCAT::SvrUtils::sendmsg("No information can be obtained for $grep_string", $callback, $node); + last; } if ($grep_string eq "uuid") { - # wait for interface + xCAT::SvrUtils::sendmsg("No information can be obtained for $grep_string", $callback, $node); + last; } if ($grep_string eq "guid") { - # wait for interface + xCAT::SvrUtils::sendmsg("No information can be obtained for $grep_string", $callback, $node); + last; } if ($grep_string eq "mac" and $key_url =~ /\/ethernet/) { @@ -923,10 +928,16 @@ sub rinv_response { foreach my $key (keys %content) { $content_info = uc ($src) . " " . $key . " : " . $content{$key}; - xCAT::SvrUtils::sendmsg("$content_info", $callback, $node); + push (@sorted_output, $node . ": ". $content_info); #Save output in array } } } + # If sorted array has any contents, sort it and print it + if (scalar @sorted_output > 0) { + @sorted_output = sort @sorted_output; #Sort all output + my $result = join "\n", @sorted_output; #Join into a single string for easier display + xCAT::SvrUtils::sendmsg("$result", $callback); + } if ($next_status{ $node_info{$node}{cur_status} }) { $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} };