Allow default schedule items to be skipped by setting to 'null'

This commit is contained in:
Oliver Gorwits
2017-12-21 20:03:10 +00:00
parent 7f8e3edfff
commit 9c60727c9f
5 changed files with 34 additions and 2 deletions

View File

@@ -1,3 +1,9 @@
2.037004 - 2017-12-21
[BUG FIXES]
* Allow default schedule items to be skipped by setting to 'null'
2.037003 - 2017-12-18 2.037003 - 2017-12-18
[BUG FIXES] [BUG FIXES]

View File

@@ -341,6 +341,11 @@ Set the PoE on/off status on a device port. Requires the C<-d> parameter
~netdisco/bin/netdisco-do power -d 192.0.2.1 -p FastEthernet0/1 -e on ~netdisco/bin/netdisco-do power -d 192.0.2.1 -p FastEthernet0/1 -e on
~netdisco/bin/netdisco-do power -d 192.0.2.1 -p FastEthernet0/1 -e off ~netdisco/bin/netdisco-do power -d 192.0.2.1 -p FastEthernet0/1 -e off
=head2 dumpconfig
Will dump the loaded and parsed configuration for the application. Pass a
specific configuration setting name to the C<-e> parameter to dump only that.
=head1 DEBUG LEVELS =head1 DEBUG LEVELS
The flags "C<-DISQ>" can be specified, multiple times, and enable the The flags "C<-DISQ>" can be specified, multiple times, and enable the

View File

@@ -20,7 +20,8 @@ sub worker_begin {
debug "entering Scheduler ($wid) worker_begin()"; debug "entering Scheduler ($wid) worker_begin()";
foreach my $action (keys %{ setting('schedule') }) { foreach my $action (keys %{ setting('schedule') }) {
my $config = setting('schedule')->{$action}; my $config = setting('schedule')->{$action}
or next;
# accept either single crontab format, or individual time fields # accept either single crontab format, or individual time fields
$config->{when} = Algorithm::Cron->new( $config->{when} = Algorithm::Cron->new(
@@ -59,7 +60,8 @@ sub worker_body {
# if any job is due, add it to the queue # if any job is due, add it to the queue
foreach my $action (keys %{ setting('schedule') }) { foreach my $action (keys %{ setting('schedule') }) {
my $sched = setting('schedule')->{$action}; my $sched = setting('schedule')->{$action}
or next;
# next occurence of job must be in this minute's window # next occurence of job must be in this minute's window
debug sprintf "sched ($wid): $action: win_start: %s, win_end: %s, next: %s", debug sprintf "sched ($wid): $action: win_start: %s, win_end: %s, next: %s",

View File

@@ -0,0 +1,18 @@
package App::Netdisco::Worker::Plugin::DumpConfig;
use Dancer ':syntax';
use App::Netdisco::Worker::Plugin;
use aliased 'App::Netdisco::Worker::Status';
use Data::Printer;
register_worker({ phase => 'main' }, sub {
my ($job, $workerconf) = @_;
my $extra = $job->extra;
my $config = config();
p ($extra ? $config->{$extra} : $config);
return Status->done('Dumped config');
});
true;

View File

@@ -330,6 +330,7 @@ worker_plugins:
- 'Discover::Wireless' - 'Discover::Wireless'
- 'Discover::WithNodes' - 'Discover::WithNodes'
- 'DiscoverAll' - 'DiscoverAll'
- 'DumpConfig'
- 'Expire' - 'Expire'
- 'ExpireNodes' - 'ExpireNodes'
- 'Graph' - 'Graph'