diff --git a/Changes b/Changes index b697d85b..9c0ddee2 100644 --- a/Changes +++ b/Changes @@ -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 [BUG FIXES] diff --git a/MANIFEST b/MANIFEST index 44f2cfca..03e9af46 100644 --- a/MANIFEST +++ b/MANIFEST @@ -201,6 +201,7 @@ lib/App/Netdisco/Worker/Plugin/Discover/VLANs.pm lib/App/Netdisco/Worker/Plugin/Discover/Wireless.pm lib/App/Netdisco/Worker/Plugin/Discover/WithNodes.pm lib/App/Netdisco/Worker/Plugin/DiscoverAll.pm +lib/App/Netdisco/Worker/Plugin/DumpConfig.pm lib/App/Netdisco/Worker/Plugin/Expire.pm lib/App/Netdisco/Worker/Plugin/ExpireNodes.pm lib/App/Netdisco/Worker/Plugin/Graph.pm diff --git a/META.json b/META.json index b35ecf34..bbed67f0 100644 --- a/META.json +++ b/META.json @@ -105,7 +105,7 @@ "provides" : { "App::Netdisco" : { "file" : "lib/App/Netdisco.pm", - "version" : "2.037003" + "version" : "2.037004" }, "App::Netdisco::AnyEvent::Nbtstat" : { "file" : "lib/App/Netdisco/AnyEvent/Nbtstat.pm" @@ -669,6 +669,9 @@ "App::Netdisco::Worker::Plugin::DiscoverAll" : { "file" : "lib/App/Netdisco/Worker/Plugin/DiscoverAll.pm" }, + "App::Netdisco::Worker::Plugin::DumpConfig" : { + "file" : "lib/App/Netdisco/Worker/Plugin/DumpConfig.pm" + }, "App::Netdisco::Worker::Plugin::Expire" : { "file" : "lib/App/Netdisco/Worker/Plugin/Expire.pm" }, @@ -749,7 +752,7 @@ }, "homepage" : "http://netdisco.org/", "license" : [ - "http://opensource.org/licenses/BSD-3-Clause" + "http://opensource.org/licenses/bsd-license.php" ], "repository" : { "url" : "https://github.com/netdisco/netdisco" @@ -757,6 +760,6 @@ "x_IRC" : "irc://irc.freenode.org/#netdisco", "x_MailingList" : "https://lists.sourceforge.net/lists/listinfo/netdisco-users" }, - "version" : "2.037003", + "version" : "2.037004", "x_serialization_backend" : "JSON::PP version 2.94" } diff --git a/META.yml b/META.yml index 548a7d89..8933f20e 100644 --- a/META.yml +++ b/META.yml @@ -18,7 +18,7 @@ name: App-Netdisco provides: App::Netdisco: file: lib/App/Netdisco.pm - version: '2.037003' + version: '2.037004' App::Netdisco::AnyEvent::Nbtstat: file: lib/App/Netdisco/AnyEvent/Nbtstat.pm App::Netdisco::Backend::Job: @@ -394,6 +394,8 @@ provides: file: lib/App/Netdisco/Worker/Plugin/Discover/WithNodes.pm App::Netdisco::Worker::Plugin::DiscoverAll: file: lib/App/Netdisco/Worker/Plugin/DiscoverAll.pm + App::Netdisco::Worker::Plugin::DumpConfig: + file: lib/App/Netdisco/Worker/Plugin/DumpConfig.pm App::Netdisco::Worker::Plugin::Expire: file: lib/App/Netdisco/Worker/Plugin/Expire.pm App::Netdisco::Worker::Plugin::ExpireNodes: @@ -518,7 +520,7 @@ resources: MailingList: https://lists.sourceforge.net/lists/listinfo/netdisco-users bugtracker: https://github.com/netdisco/netdisco/issues homepage: http://netdisco.org/ - license: http://opensource.org/licenses/BSD-3-Clause + license: http://opensource.org/licenses/bsd-license.php repository: https://github.com/netdisco/netdisco -version: '2.037003' +version: '2.037004' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff --git a/bin/netdisco-do b/bin/netdisco-do index ed84659a..08d82bd2 100755 --- a/bin/netdisco-do +++ b/bin/netdisco-do @@ -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 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 The flags "C<-DISQ>" can be specified, multiple times, and enable the diff --git a/lib/App/Netdisco.pm b/lib/App/Netdisco.pm index fd745aba..8e36679f 100644 --- a/lib/App/Netdisco.pm +++ b/lib/App/Netdisco.pm @@ -4,7 +4,7 @@ use strict; use warnings; use 5.010_000; -our $VERSION = '2.037003'; +our $VERSION = '2.037004'; use App::Netdisco::Configuration; =head1 NAME diff --git a/lib/App/Netdisco/Backend/Role/Scheduler.pm b/lib/App/Netdisco/Backend/Role/Scheduler.pm index a62f3f22..eb946258 100644 --- a/lib/App/Netdisco/Backend/Role/Scheduler.pm +++ b/lib/App/Netdisco/Backend/Role/Scheduler.pm @@ -20,7 +20,8 @@ sub worker_begin { debug "entering Scheduler ($wid) worker_begin()"; 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 $config->{when} = Algorithm::Cron->new( @@ -59,7 +60,8 @@ sub worker_body { # if any job is due, add it to the queue 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 debug sprintf "sched ($wid): $action: win_start: %s, win_end: %s, next: %s", diff --git a/lib/App/Netdisco/Worker/Plugin/DumpConfig.pm b/lib/App/Netdisco/Worker/Plugin/DumpConfig.pm new file mode 100644 index 00000000..3c57288a --- /dev/null +++ b/lib/App/Netdisco/Worker/Plugin/DumpConfig.pm @@ -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; diff --git a/share/config.yml b/share/config.yml index 2b705812..d80eb29f 100644 --- a/share/config.yml +++ b/share/config.yml @@ -332,6 +332,7 @@ worker_plugins: - 'Discover::Wireless' - 'Discover::WithNodes' - 'DiscoverAll' + - 'DumpConfig' - 'Expire' - 'ExpireNodes' - 'Graph'