From 1f1af381fb59079be37a580303516de8b1f68294 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Thu, 1 Feb 2018 15:32:35 +0000 Subject: [PATCH] Do not attempt Canonical IP change to non-discoverable IP [skip ci] --- Changes | 4 ++++ lib/App/Netdisco/Worker/Plugin/Discover/CanonicalIP.pm | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/Changes b/Changes index 25b35fee..b4c8f4d2 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,10 @@ * #332 Autodiscovery via BGP and OSPF peers + [ENHANCEMENTS] + + * Do not attempt Canonical IP change to non-discoverable IP + 2.038034 - 2018-01-31 [NEW FEATURES] diff --git a/lib/App/Netdisco/Worker/Plugin/Discover/CanonicalIP.pm b/lib/App/Netdisco/Worker/Plugin/Discover/CanonicalIP.pm index ffd3e242..cfa179fb 100644 --- a/lib/App/Netdisco/Worker/Plugin/Discover/CanonicalIP.pm +++ b/lib/App/Netdisco/Worker/Plugin/Discover/CanonicalIP.pm @@ -7,6 +7,7 @@ use aliased 'App::Netdisco::Worker::Status'; use App::Netdisco::Transport::SNMP (); use App::Netdisco::Util::Permission 'check_acl_only'; use App::Netdisco::Util::DNS 'ipv4_from_hostname'; +use App::Netdisco::Util::Device 'is_discoverable'; use Dancer::Plugin::DBIC 'schema'; register_worker({ phase => 'main', driver => 'snmp' }, sub { @@ -46,6 +47,12 @@ register_worker({ phase => 'main', driver => 'snmp' }, sub { if (check_acl_only($device, $key) and check_acl_only($alias, $map->{$key})) { + if (not is_discoverable( $alias->alias )) { + debug sprintf ' [%s] device - cannot renumber to %s - not discoverable', + $old_ip, $alias->alias; + next; + } + if (App::Netdisco::Transport::SNMP->test_connection( $alias->alias )) { $new_ip = $alias->alias; last ALIAS;