Do not attempt Canonical IP change to non-discoverable IP [skip ci]

This commit is contained in:
Oliver Gorwits
2018-02-01 15:32:35 +00:00
parent 3efaebdae1
commit 1f1af381fb
2 changed files with 11 additions and 0 deletions

View File

@@ -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;