no need to list all plugins
This commit is contained in:
1
Build.PL
1
Build.PL
@@ -43,6 +43,7 @@ Module::Build->new(
|
|||||||
'JSON::XS' => '3.01',
|
'JSON::XS' => '3.01',
|
||||||
'List::MoreUtils' => '0.33',
|
'List::MoreUtils' => '0.33',
|
||||||
'MIME::Base64' => '3.13',
|
'MIME::Base64' => '3.13',
|
||||||
|
'Module::Find' => '0.13',
|
||||||
'Module::Load' => '0.32',
|
'Module::Load' => '0.32',
|
||||||
'Moo' => '1.001000',
|
'Moo' => '1.001000',
|
||||||
'MCE' => '1.703',
|
'MCE' => '1.703',
|
||||||
|
|||||||
@@ -4,19 +4,20 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
use Module::Load ();
|
use Module::Load ();
|
||||||
|
use Module::Find 'findallmod';
|
||||||
use Dancer ':syntax';
|
use Dancer ':syntax';
|
||||||
|
|
||||||
# load worker plugins for our workers
|
# load worker plugins for our action
|
||||||
|
|
||||||
sub load_worker_plugins {
|
sub import {
|
||||||
my ($action, $plugin_list) = @_;
|
my ($class, $action) = @_;
|
||||||
|
die "missing action\n" unless $action;
|
||||||
|
|
||||||
foreach my $plugin (@$plugin_list) {
|
my @user_plugins = @{ setting('extra_worker_plugins') || [] };
|
||||||
$plugin =~ s/^X::/+App::NetdiscoX::Worker::Plugin::/;
|
my @core_plugins = findallmod 'App::Netdisco::Worker::Plugin';
|
||||||
$plugin = 'App::Netdisco::Worker::Plugin::'. $plugin
|
|
||||||
if $plugin !~ m/^\+/;
|
|
||||||
$plugin =~ s/^\+//;
|
|
||||||
|
|
||||||
|
foreach my $plugin (@user_plugins, @core_plugins) {
|
||||||
|
$plugin =~ s/^X::/App::NetdiscoX::Worker::Plugin::/;
|
||||||
next unless $plugin =~ m/::Plugin::${action}(?:::|$)/i;
|
next unless $plugin =~ m/::Plugin::${action}(?:::|$)/i;
|
||||||
|
|
||||||
debug "loading worker plugin $plugin";
|
debug "loading worker plugin $plugin";
|
||||||
@@ -24,10 +25,4 @@ sub load_worker_plugins {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub import {
|
|
||||||
my ($class, $action) = @_;
|
|
||||||
load_worker_plugins( $action, setting('extra_worker_plugins') || [] );
|
|
||||||
load_worker_plugins( $action, setting('worker_plugins') || [] );
|
|
||||||
}
|
|
||||||
|
|
||||||
true;
|
true;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ sub run {
|
|||||||
$self->job($job);
|
$self->job($job);
|
||||||
|
|
||||||
my $action = $job->action;
|
my $action = $job->action;
|
||||||
Module::Load::load 'App::Netdisco::Worker', $action;
|
Module::Load::load 'App::Netdisco::Worker' => $action;
|
||||||
|
|
||||||
my @newuserconf = ();
|
my @newuserconf = ();
|
||||||
my @userconf = @{ setting('device_auth') || [] };
|
my @userconf = @{ setting('device_auth') || [] };
|
||||||
|
|||||||
@@ -253,43 +253,9 @@ job_prio:
|
|||||||
- nbtstat
|
- nbtstat
|
||||||
- expire
|
- expire
|
||||||
|
|
||||||
# standards go into ::RFC
|
|
||||||
# such as: SNMP, NETCONF, RESTCONF
|
|
||||||
# others go into new ::DRIVERNAME
|
|
||||||
# such as: ::CLI ::eAPI
|
|
||||||
|
|
||||||
extra_worker_plugins: []
|
extra_worker_plugins: []
|
||||||
# - Discover::ConfigBackup::CLI
|
# - Discover::ConfigBackup::CLI
|
||||||
|
|
||||||
# FIXME
|
|
||||||
worker_plugins:
|
|
||||||
- Discover::Properties::RFC
|
|
||||||
- Discover::Interfaces::RFC
|
|
||||||
- Discover::PortPower::RFC
|
|
||||||
- Discover::Neighbors::RFC
|
|
||||||
- Discover::NeighborProperties::RFC
|
|
||||||
- Discover::BGPNeighbors::RFC
|
|
||||||
- Discover::OSPFNeighbors::RFC
|
|
||||||
- Discover::VLANs::RFC
|
|
||||||
- Discover::Wireless::RFC
|
|
||||||
- Discover::Entities::RFC
|
|
||||||
- Macsuck::Nodes::RFC
|
|
||||||
- Macsuck::WirelessNodes::RFC
|
|
||||||
- Arpnip::Nodes::CLI
|
|
||||||
- Arpnip::Nodes::RFC
|
|
||||||
- Arpnip::Subnets::RFC
|
|
||||||
- Nbtwalk
|
|
||||||
- Nbtstat
|
|
||||||
- Nbtstat::Core
|
|
||||||
- Graph
|
|
||||||
- Stats
|
|
||||||
- Monitor
|
|
||||||
- Delete
|
|
||||||
- Show
|
|
||||||
- Psql
|
|
||||||
- Renumber
|
|
||||||
- Test
|
|
||||||
|
|
||||||
# ---------------
|
# ---------------
|
||||||
# GraphViz Export
|
# GraphViz Export
|
||||||
# ---------------
|
# ---------------
|
||||||
|
|||||||
Reference in New Issue
Block a user