change q to enqueue and add quiet

This commit is contained in:
Oliver Gorwits
2018-02-22 22:22:09 +00:00
parent e08376ba0b
commit e67c20b78e

View File

@@ -37,8 +37,6 @@ BEGIN {
use App::Netdisco; use App::Netdisco;
use Dancer qw/:moose :script/; use Dancer qw/:moose :script/;
info "App::Netdisco version $App::Netdisco::VERSION loaded.";
use Try::Tiny; use Try::Tiny;
use Pod::Usage; use Pod::Usage;
use Scalar::Util 'blessed'; use Scalar::Util 'blessed';
@@ -51,7 +49,7 @@ use App::Netdisco::Util::Device 'get_device';
use Getopt::Long; use Getopt::Long;
Getopt::Long::Configure ("bundling"); Getopt::Long::Configure ("bundling");
my ($device, $port, $extra, $debug, $queue_only, $rollback); my ($device, $port, $extra, $debug, $quiet, $queue_only, $rollback);
my ($infotrace, $snmptrace, $sqltrace) = (0, 0, 0); my ($infotrace, $snmptrace, $sqltrace) = (0, 0, 0);
my $result = GetOptions( my $result = GetOptions(
@@ -59,7 +57,8 @@ my $result = GetOptions(
'port|p=s' => \$port, 'port|p=s' => \$port,
'extra|e=s' => \$extra, 'extra|e=s' => \$extra,
'debug|D' => \$debug, 'debug|D' => \$debug,
'queue|q' => \$queue_only, 'enqueue' => \$queue_only,
'quiet' => \$quiet,
'rollback|R' => \$rollback, 'rollback|R' => \$rollback,
'infotrace|I+' => \$infotrace, 'infotrace|I+' => \$infotrace,
'snmptrace|S+' => \$snmptrace, 'snmptrace|S+' => \$snmptrace,
@@ -72,7 +71,7 @@ my $result = GetOptions(
my $CONFIG = config(); my $CONFIG = config();
$CONFIG->{logger} = 'console'; $CONFIG->{logger} = 'console';
$CONFIG->{log} = ($debug ? 'debug' : 'info'); $CONFIG->{log} = ($debug ? 'debug' : ($quiet ? 'error' : 'info'));
$ENV{INFO_TRACE} ||= $infotrace; $ENV{INFO_TRACE} ||= $infotrace;
$ENV{SNMP_TRACE} ||= $snmptrace; $ENV{SNMP_TRACE} ||= $snmptrace;
@@ -82,6 +81,8 @@ $ENV{ND2_DB_ROLLBACK} ||= $rollback;
# reconfigure logging to force console output # reconfigure logging to force console output
Dancer::Logger->init('console', $CONFIG); Dancer::Logger->init('console', $CONFIG);
info "App::Netdisco version $App::Netdisco::VERSION loaded.";
# get requested action # get requested action
(my $action = shift @ARGV) =~ s/^set_// (my $action = shift @ARGV) =~ s/^set_//
if scalar @ARGV; if scalar @ARGV;
@@ -171,7 +172,7 @@ netdisco-do - Run any Netdisco job from the command-line.
=head1 SYNOPSIS =head1 SYNOPSIS
~/bin/netdisco-do <action> [-DISQRq] [-d <device> [-p <port>] [-e <extra>]] ~/bin/netdisco-do <action> [-DISQR] [--enqueue] [--quiet] [-d <device> [-p <port>] [-e <extra>]]
=head1 DESCRIPTION =head1 DESCRIPTION
@@ -183,9 +184,9 @@ Note that some jobs (C<discoverall>, C<macwalk>, C<arpwalk>, C<nbtwalk>)
simply add entries to the Netdisco job queue for other jobs, so won't seem simply add entries to the Netdisco job queue for other jobs, so won't seem
to do much when you trigger them. Everything else happens in real-time. to do much when you trigger them. Everything else happens in real-time.
However the flag "C<-q>" will force the queueing of the job, regardless of However the "C<--enqueue>" option will force the queueing of the job,
type. This may be useful for cron-driven actions, or for actions working regardless of type. This may be useful for cron-driven actions, or for actions
across large IP spaces. working across large IP spaces.
For any action, if you wish to run one of its individual worker stages, then For any action, if you wish to run one of its individual worker stages, then
pass C<action::stage> as the first argument to C<netdisco-do>, for example pass C<action::stage> as the first argument to C<netdisco-do>, for example