2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-07-31 18:19:40 +00:00

fix(rspconfig): clearer error when no option is given

Running rspconfig against an mgt=ipmi node with no option fell through to the
generic "Unsupported command: rspconfig " message (with an empty option),
which does not tell the user what is wrong. Detect the empty option in
preprocess_request and report that options are required.

Recovered from the unmerged lenovobuild branch (original 08ae94bd).

Co-authored-by: Jarrod Johnson <10814490+jjohnson42@users.noreply.github.com>
This commit is contained in:
Vinícius Ferrão
2026-07-22 19:59:15 -03:00
parent cf44f51463
commit 854babe0c5
+9
View File
@@ -8404,6 +8404,15 @@ sub preprocess_request {
$option = $_;
$optset = 0;
}
if ($option eq '') {
foreach (@$all_noderange) {
$error_data .= "\n" if ($error_data);
$error_data .= "$_: options are required when using mgt=ipmi, see -h or the man page";
}
$callback->({ errorcode => [1], data => [ $error_data ] });
$request = {};
return;
}
unless ($option =~ /^USERID$|^ip$|^netmask$|^gateway$|^vlan$|^userid$|^username$|^password$|^snmpdest|^thermprofile$|^alert$|^garp$|^community$|^backupgateway$/) {
foreach (@$all_noderange) {
$error_data .= "\n" if ($error_data);