From d2661bff61717dc74347cd9b3b5602bc6cb87bd9 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sun, 25 Aug 2019 18:18:02 +0100 Subject: [PATCH] first make arpnip behave like other jobs towards pseudo devices --- lib/App/Netdisco/Worker/Plugin/Arpnip.pm | 3 +++ lib/App/Netdisco/Worker/Plugin/Arpwalk.pm | 5 +++-- share/schema_versions/App-Netdisco-DB-58-59-PostgreSQL.sql | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/App/Netdisco/Worker/Plugin/Arpnip.pm b/lib/App/Netdisco/Worker/Plugin/Arpnip.pm index 12e8f1e35..caff485a9 100644 --- a/lib/App/Netdisco/Worker/Plugin/Arpnip.pm +++ b/lib/App/Netdisco/Worker/Plugin/Arpnip.pm @@ -16,6 +16,9 @@ register_worker({ phase => 'check' }, sub { return Status->error("arpnip skipped: $device not yet discovered") unless $device->in_storage; + return Status->info("macsuck skipped: $device is pseudo-device") + if $device->is_pseudo; + return Status->info("arpnip skipped: $device has no layer 3 capability") unless $device->has_layer(3); diff --git a/lib/App/Netdisco/Worker/Plugin/Arpwalk.pm b/lib/App/Netdisco/Worker/Plugin/Arpwalk.pm index a7a218373..599aba4cb 100644 --- a/lib/App/Netdisco/Worker/Plugin/Arpwalk.pm +++ b/lib/App/Netdisco/Worker/Plugin/Arpwalk.pm @@ -11,8 +11,9 @@ register_worker({ phase => 'main' }, sub { my ($job, $workerconf) = @_; my %queued = map {$_ => 1} jq_queued('arpnip'); - my @devices = schema('netdisco')->resultset('Device') - ->has_layer('3')->get_column('ip')->all; + my @devices = schema('netdisco')->resultset('Device')->search({ + -or => [ 'vendor' => undef, 'vendor' => { '!=' => 'netdisco' }], + })->has_layer('3')->get_column('ip')->all; my @filtered_devices = grep {!exists $queued{$_}} @devices; jq_insert([ diff --git a/share/schema_versions/App-Netdisco-DB-58-59-PostgreSQL.sql b/share/schema_versions/App-Netdisco-DB-58-59-PostgreSQL.sql index cd073f780..043f04e79 100644 --- a/share/schema_versions/App-Netdisco-DB-58-59-PostgreSQL.sql +++ b/share/schema_versions/App-Netdisco-DB-58-59-PostgreSQL.sql @@ -2,4 +2,6 @@ BEGIN; ALTER TABLE users ADD COLUMN "radius" boolean DEFAULT false; +UPDATE device SET layers = NULL WHERE vendor = 'netdisco'; + COMMIT;