2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-31 01:56:39 +00:00

Merge pull request #3879 from whowutwut/discover_condensed

Reduce the output of bmcdiscover when writing entries to the DB
This commit is contained in:
zet809 2017-09-12 11:00:27 +08:00 committed by GitHub
commit d0c463dae2

View File

@ -1082,19 +1082,8 @@ sub bmcdiscovery_ipmi {
xCAT::MsgUtils->message("W", { data => ["BMC password is incorrect for $ip"] }, $::CALLBACK);
return;
}
if (defined($opz) || defined($opw))
{
format_stanza($node, $node_data, "ipmi");
if (defined($opw))
{
write_to_xcatdb($node, $node_data, "ipmi", $request_command);
}
}
else {
my $rsp = {};
push @{ $rsp->{data} }, "$node_data";
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
}
display_output($opz,$opw,$node,$node_data,"ipmi",$request_command);
}
}
@ -1205,12 +1194,38 @@ sub bmcdiscovery_openbmc{
}
return;
}
display_output($opz,$opw,$node,$node_data,"openbmc",$request_command);
}
if (defined($opz) || defined($opw)) {
format_stanza($node, $node_data, "openbmc");
if (defined($opw)) {
write_to_xcatdb($node, $node_data, "openbmc", $request_command);
#-----------------------------------------------------------------------------
=head3 display_output
Common code to print output of bmcdiscover
=cut
#-----------------------------------------------------------------------------
sub display_output {
my $opz = shift;
my $opw = shift;
my $node = shift;
my $node_data = shift;
my $mgttype = shift;
my $request_command = shift;
if (defined($opw)) {
my $rsp = {};
push @{ $rsp->{data} }, "Writing $node ($node_data) to database...";
xCAT::MsgUtils->message("I", $rsp, $::CALLBACK);
if (defined($opz)) {
format_stanza($node, $node_data, $mgttype);
}
write_to_xcatdb($node, $node_data, $mgttype, $request_command);
}
elsif (defined($opz)) {
format_stanza($node, $node_data, $mgttype);
} else {
my $rsp = {};
push @{ $rsp->{data} }, "$node_data";