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

Fix issue 3383, do not allow setting and getting in one command for rspconfig

This commit is contained in:
XuWei
2017-07-05 02:39:19 -04:00
parent d6d34d0256
commit 130c30c7d7

View File

@ -8076,11 +8076,37 @@ sub preprocess_request {
xCAT::Utils->filter_nodes($request, undef, undef, \@bmcnodes, \@nohandle);
$realnoderange = \@bmcnodes;
} elsif ($command eq "rspconfig") {
# filter out the nodes which should be handled by ipmi.pm
my (@bmcnodes, @nohandle);
xCAT::Utils->filter_nodes($request, undef, undef, \@bmcnodes, \@nohandle);
$realnoderange = \@bmcnodes;
if ($realnoderange) {
my $optset = 0;
my $optget = 0;
foreach (@exargs) {
if ($_ =~ /^(\w+)=(.*)/) {
$optset = 1;
my $option = $1;
unless ($option =~ /^USERID$|^ip$|^netmask$|^gateway$|^vlan$|^userid$|^username$|^password$|^snmpdest|^thermprofile$|^alert$|^garp$|^community$|^backupgateway$/) {
$callback->({ errorcode => [1], data => [ "Unsupported command: $command $option"] });
$request = {};
return;
}
} elsif ($_ =~ /^ip$|^netmask$|^gateway$|^vlan$|^userid$|^username$|^password$|^snmpdest|^thermprofile$|^alert$|^garp$|^community$|^backupgateway$/) {
$optget = 1;
} else {
$callback->({ errorcode => [1], data => [ "Unsupported command: $command $_"] });
$request = {};
return;
}
}
if ($optset and $optget) {
$callback->({ errorcode => [1], data => [ "Do not set and get information in the same command for $command."] });
$request = {};
return;
}
}
} elsif ($command eq "rinv") {
if ($exargs[0] eq "-t" and $#exargs == 0) {
unshift @{ $request->{arg} }, 'all';