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',
|
||||
'List::MoreUtils' => '0.33',
|
||||
'MIME::Base64' => '3.13',
|
||||
'Module::Find' => '0.13',
|
||||
'Module::Load' => '0.32',
|
||||
'Moo' => '1.001000',
|
||||
'MCE' => '1.703',
|
||||
|
||||
@@ -4,19 +4,20 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use Module::Load ();
|
||||
use Module::Find 'findallmod';
|
||||
use Dancer ':syntax';
|
||||
|
||||
# load worker plugins for our workers
|
||||
# load worker plugins for our action
|
||||
|
||||
sub load_worker_plugins {
|
||||
my ($action, $plugin_list) = @_;
|
||||
sub import {
|
||||
my ($class, $action) = @_;
|
||||
die "missing action\n" unless $action;
|
||||
|
||||
foreach my $plugin (@$plugin_list) {
|
||||
$plugin =~ s/^X::/+App::NetdiscoX::Worker::Plugin::/;
|
||||
$plugin = 'App::Netdisco::Worker::Plugin::'. $plugin
|
||||
if $plugin !~ m/^\+/;
|
||||
$plugin =~ s/^\+//;
|
||||
my @user_plugins = @{ setting('extra_worker_plugins') || [] };
|
||||
my @core_plugins = findallmod 'App::Netdisco::Worker::Plugin';
|
||||
|
||||
foreach my $plugin (@user_plugins, @core_plugins) {
|
||||
$plugin =~ s/^X::/App::NetdiscoX::Worker::Plugin::/;
|
||||
next unless $plugin =~ m/::Plugin::${action}(?:::|$)/i;
|
||||
|
||||
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;
|
||||
|
||||
@@ -33,7 +33,7 @@ sub run {
|
||||
$self->job($job);
|
||||
|
||||
my $action = $job->action;
|
||||
Module::Load::load 'App::Netdisco::Worker', $action;
|
||||
Module::Load::load 'App::Netdisco::Worker' => $action;
|
||||
|
||||
my @newuserconf = ();
|
||||
my @userconf = @{ setting('device_auth') || [] };
|
||||
|
||||
@@ -253,43 +253,9 @@ job_prio:
|
||||
- nbtstat
|
||||
- expire
|
||||
|
||||
# standards go into ::RFC
|
||||
# such as: SNMP, NETCONF, RESTCONF
|
||||
# others go into new ::DRIVERNAME
|
||||
# such as: ::CLI ::eAPI
|
||||
|
||||
extra_worker_plugins: []
|
||||
# - 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
|
||||
# ---------------
|
||||
|
||||
Reference in New Issue
Block a user