2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-12 17:30:19 +00:00

Merge pull request #4573 from xuweibj/T4474

rspconfig gard -c|--clear for OpenBMC
This commit is contained in:
Victor Hu
2017-12-20 10:52:02 -05:00
committed by GitHub

View File

@ -449,6 +449,14 @@ my %status_info = (
RSPCONFIG_SSHCFG_RESPONSE => {
process => \&rspconfig_sshcfg_response,
},
RSPCONFIG_CLEAR_GARD_REQUEST => {
method => "POST",
init_url => "/org/open_power/control/gard/action/Reset",
data => "[]",
},
RSPCONFIG_CLEAR_GARD_RESPONSE => {
process => \&rspconfig_response,
},
RSPCONFIG_DUMP_LIST_REQUEST => {
method => "GET",
init_url => "$openbmc_project_url/dump/enumerate",
@ -1096,6 +1104,13 @@ sub parse_args {
} elsif ($subcommand =~ /^sshcfg$/) {
return ([ 1, "Configure sshcfg must be issued without other options." ]) if ($num_subcommand > 1);
$setorget = ""; # SSH Keys are copied using a RShellAPI, not REST API
} elsif ($subcommand eq "gard") {
my $option = "";
$option = $ARGV[1] if (defined $ARGV[1]);
return ([ 1, "Clear GARD cannot be issued with other options." ]) if ($num_subcommand > 2);
return ([ 1, "Invalid parameter for $command $subcommand $option" ]) if ($option !~ /^-c$|^--clear$/);
$setorget = "";
return;
} elsif ($subcommand eq "dump") {
my $option = "";
$option = $ARGV[1] if (defined $ARGV[1]);
@ -1563,6 +1578,10 @@ sub parse_command_status {
$next_status{RSPCONFIG_DUMP_DOWNLOAD_REQUEST} = "RSPCONFIG_DUMP_DOWNLOAD_RESPONSE";
}
return 0;
} elsif ($subcommand eq "gard") {
$next_status{LOGIN_RESPONSE} = "RSPCONFIG_CLEAR_GARD_REQUEST";
$next_status{RSPCONFIG_CLEAR_GARD_REQUEST} = "RSPCONFIG_CLEAR_GARD_RESPONSE";
return 0;
}
if ($subcommand =~ /^admin_passwd=(.+),(.+)/) {
@ -3225,6 +3244,12 @@ sub rspconfig_response {
return;
}
if ($node_info{$node}{cur_status} eq "RSPCONFIG_CLEAR_GARD_RESPONSE") {
if ($response_info->{'message'} eq $::RESPONSE_OK) {
xCAT::SvrUtils::sendmsg("GARD cleared", $callback, $node);
}
}
if ($next_status{ $node_info{$node}{cur_status} }) {
if ($node_info{$node}{cur_status} eq "RSPCONFIG_CHECK_RESPONSE") {
$node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }{$origin_type};