diff --git a/bin/netdisco-do b/bin/netdisco-do index e22691a5..4892cab7 100755 --- a/bin/netdisco-do +++ b/bin/netdisco-do @@ -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;