#1067 add --force for enqueue of more than 512 jobs
This commit is contained in:
@@ -49,7 +49,7 @@ use App::Netdisco::Util::Device 'get_device';
|
||||
use Getopt::Long;
|
||||
Getopt::Long::Configure ("bundling");
|
||||
|
||||
my ($port, $extra, $debug, $quiet, $queue_only, $rollback);
|
||||
my ($port, $extra, $debug, $quiet, $queue_only, $force, $rollback);
|
||||
my ($devices, $infotrace, $snmptrace, $sqltrace) = ([], 0, 0, 0);
|
||||
|
||||
my $result = GetOptions(
|
||||
@@ -58,6 +58,7 @@ my $result = GetOptions(
|
||||
'extra|e=s' => \$extra,
|
||||
'debug|D' => \$debug,
|
||||
'enqueue' => \$queue_only,
|
||||
'force' => \$force,
|
||||
'quiet' => \$quiet,
|
||||
'rollback|R' => \$rollback,
|
||||
'infotrace|I+' => \$infotrace,
|
||||
@@ -114,7 +115,7 @@ foreach my $device (@$devices) {
|
||||
my @job_specs = ();
|
||||
my $exitstatus = 0;
|
||||
|
||||
if (scalar @hostlist > 512) {
|
||||
if (not $force and scalar @hostlist > 512) {
|
||||
info sprintf '%s: aborted - unwise to attempt %s jobs at once', $action, (scalar @hostlist);
|
||||
exit 1;
|
||||
}
|
||||
@@ -123,7 +124,9 @@ if (scalar @hostlist > 512) {
|
||||
@hostlist = (undef) if 0 == scalar @hostlist;
|
||||
|
||||
foreach my $host (@hostlist) {
|
||||
my $dev = $host ? get_device($host->addr) : undef;
|
||||
my $dev = $host
|
||||
? ((not ($queue_only and $force)) ? get_device($host->addr) : $host->addr)
|
||||
: undef;
|
||||
if ($dev and not (blessed $dev and $dev->in_storage) and $action !~ m/^(?:discover|addpseudodevice)/) {
|
||||
info sprintf "%s: error - Don't know device: %s", $action, $host->addr;
|
||||
next;
|
||||
|
||||
Reference in New Issue
Block a user