mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-07-28 07:11:11 +00:00
show node name with error msg for ipmi
This commit is contained in:
@@ -8264,13 +8264,20 @@ sub preprocess_request {
|
||||
return;
|
||||
}
|
||||
|
||||
my $all_noderange = $realnoderange;
|
||||
|
||||
if ($command eq "rpower") {
|
||||
my $subcmd = $exargs[0];
|
||||
if ($subcmd eq '') {
|
||||
|
||||
#$callback->({data=>["Please enter an action (eg: boot,off,on, etc)", $usage_string]});
|
||||
#Above statement will miss error code, so replaced by the below statement
|
||||
$callback->({ errorcode => [1], data => [ "Please enter an action (eg: boot,off,on, etc)", $usage_string ] });
|
||||
my $error_data = "";
|
||||
foreach (@$all_noderange) {
|
||||
$error_data .= "\n" if ($error_data);
|
||||
$error_data .= "$_: Please enter an action (eg: boot,off,on, etc)";
|
||||
}
|
||||
$callback->({ errorcode => [1], data => [ $error_data, $usage_string ] });
|
||||
$request = {};
|
||||
return 0;
|
||||
}
|
||||
@@ -8284,13 +8291,23 @@ sub preprocess_request {
|
||||
|
||||
#$callback->({data=>["Unsupported command: $command $subcmd", $usage_string]});
|
||||
#Above statement will miss error code, so replaced by the below statement
|
||||
$callback->({ errorcode => [1], data => [ "Unsupported command: $command $subcmd", $usage_string ] });
|
||||
my $error_data = "";
|
||||
foreach (@$all_noderange) {
|
||||
$error_data .= "\n" if ($error_data);
|
||||
$error_data .= "$_: Error: Unsupported command: $command $subcmd";
|
||||
}
|
||||
$callback->({ errorcode => [1], data => [ $error_data, $usage_string ] });
|
||||
$request = {};
|
||||
return;
|
||||
}
|
||||
if (($subcmd eq 'on' or $subcmd eq 'reset' or $subcmd eq 'boot') and $::XCATSITEVALS{syspowerinterval}) {
|
||||
unless ($::XCATSITEVALS{syspowermaxnodes}) {
|
||||
$callback->({ errorcode => [1], error => ["IPMI plugin requires syspowermaxnodes be defined if syspowerinterval is defined"] });
|
||||
my $error_data = "";
|
||||
foreach (@$all_noderange) {
|
||||
$error_data .= "\n" if ($error_data);
|
||||
$error_data .= "$_: IPMI plugin requires syspowermaxnodes be defined if syspowerinterval is defined";
|
||||
}
|
||||
$callback->({ errorcode => [1], error => [$error_data] });
|
||||
$request = {};
|
||||
return 0;
|
||||
}
|
||||
@@ -8312,10 +8329,15 @@ sub preprocess_request {
|
||||
if ($realnoderange) {
|
||||
my $optset;
|
||||
my $option;
|
||||
my $error_data = "";
|
||||
foreach (@exargs) {
|
||||
if ($_ =~ /^(\w+)=(.*)/) {
|
||||
if ($optset eq 0) {
|
||||
$callback->({ errorcode => [1], data => [ "Usage Error: Cannot display and change attributes on the same command."] });
|
||||
foreach (@$all_noderange) {
|
||||
$error_data .= "\n" if ($error_data);
|
||||
$error_data .= "$_: Usage Error: Cannot display and change attributes on the same command.";
|
||||
}
|
||||
$callback->({ errorcode => [1], data => [ $error_data] });
|
||||
$request = {};
|
||||
return;
|
||||
}
|
||||
@@ -8323,7 +8345,11 @@ sub preprocess_request {
|
||||
$option = $1;
|
||||
} else {
|
||||
if ($optset eq 1) {
|
||||
$callback->({ errorcode => [1], data => [ "Usage Error: Cannot display and change attributes on the same command."] });
|
||||
foreach (@$all_noderange) {
|
||||
$error_data .= "\n" if ($error_data);
|
||||
$error_data .= "$_: Usage Error: Cannot display and change attributes on the same command.";
|
||||
}
|
||||
$callback->({ errorcode => [1], data => [ $error_data] });
|
||||
$request = {};
|
||||
return;
|
||||
}
|
||||
@@ -8331,7 +8357,11 @@ sub preprocess_request {
|
||||
$optset = 0;
|
||||
}
|
||||
unless ($option =~ /^USERID$|^ip$|^netmask$|^gateway$|^vlan$|^userid$|^username$|^password$|^snmpdest|^thermprofile$|^alert$|^garp$|^community$|^backupgateway$/) {
|
||||
$callback->({ errorcode => [1], data => [ "Unsupported command: $command $_"] });
|
||||
foreach (@$all_noderange) {
|
||||
$error_data .= "\n" if ($error_data);
|
||||
$error_data .= "$_: Error: Unsupported command: $command $option";
|
||||
}
|
||||
$callback->({ errorcode => [1], data => [ $error_data ] });
|
||||
$request = {};
|
||||
return;
|
||||
}
|
||||
@@ -8341,7 +8371,12 @@ sub preprocess_request {
|
||||
if ($exargs[0] eq "-t" and $#exargs == 0) {
|
||||
unshift @{ $request->{arg} }, 'all';
|
||||
} elsif ((grep /-t/, @exargs) and !(grep /(all|vpd)/, @exargs)) {
|
||||
$callback->({ errorcode => [1], error => ["option '-t' can only work with 'all' or 'vpd'"] });
|
||||
my $error_data = "";
|
||||
foreach (@$all_noderange) {
|
||||
$error_data .= "\n" if ($error_data);
|
||||
$error_data .= "$_: option '-t' can only work with 'all' or 'vpd";
|
||||
}
|
||||
$callback->({ errorcode => [1], data => [ $error_data ] });
|
||||
$request = {};
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user