2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 09:13:08 +00:00

Merge pull request #4054 from whowutwut/protect_rflash_options

Change to protect from user specifying multiple firmware to activate/delete
This commit is contained in:
Victor Hu 2017-10-05 16:46:27 -04:00 committed by GitHub
commit 1b9956e1fa

View File

@ -912,6 +912,7 @@ sub parse_command_status {
my $upload = 0;
my $activate = 0;
my $update_file;
my @flash_arguments;
foreach $subcommand (@$subcommands) {
if ($subcommand =~ /-c|--check/) {
@ -926,9 +927,17 @@ sub parse_command_status {
$activate = 1;
} else {
$update_file = $subcommand;
push (@flash_arguments, $subcommand);
}
}
if (scalar @flash_arguments > 1) {
my $flag = "";
if ($delete) { $flag = "to delete"; }
if ($activate) { $flag = "to activate"; }
xCAT::SvrUtils::sendmsg([1, "More than one firmware specified $flag is currently not supported."], $callback);
return 1;
}
my $file_id = undef;
my $grep_cmd = "/usr/bin/grep -a";
my $version_tag = '"^version="';