From ee86e62ac7c4bdc89e8d5ec34f55db2d4df02b14 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Wed, 22 Jan 2020 21:19:04 +0000 Subject: [PATCH] fix bug in vlan filtered netmap, duplicate nodes --- Changes | 8 +++++++- lib/App/Netdisco/Web/Plugin/Device/Neighbors.pm | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index c84e7a20..318ae850 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,9 @@ +2.044006 - 2019-01-22 + + [BUG FIXES] + + * #677 neighbors map with VLAN filter should only consider configured ports + 2.044005 - 2019-01-19 [ENHANCEMENTS] @@ -13,8 +19,8 @@ * #81 (redux) avoid DEPRECATED warning from DBIC * #524 ipinventory misses mac address for device ips - * #667 neighbors map with VLAN filter should only consider configured ports * #676 remove vim settings from files + * #677 neighbors map with VLAN filter should only consider configured ports * #679 uninitialised error * #686 makerancidconf excluded setting should be (ACL) list not dict diff --git a/lib/App/Netdisco/Web/Plugin/Device/Neighbors.pm b/lib/App/Netdisco/Web/Plugin/Device/Neighbors.pm index 3e10a659..874e36e3 100644 --- a/lib/App/Netdisco/Web/Plugin/Device/Neighbors.pm +++ b/lib/App/Netdisco/Web/Plugin/Device/Neighbors.pm @@ -216,7 +216,10 @@ ajax '/ajax/data/device/netmap' => require_login sub { ); } + my %seen_node = (); DEVICE: while (my $device = $devices->next) { + next if $seen_node{$device->ip}; + # if in neighbors mode then use %ok_dev to filter next DEVICE if ($device->ip ne $qdev->ip) and ($mapshow eq 'neighbors') @@ -269,6 +272,8 @@ ajax '/ajax/data/device/netmap' => require_login sub { } push @{$data{'nodes'}}, $node; + ++$seen_node{$device->ip}; + $metadata{'centernode'} = $device->ip if $qdev and $qdev->in_storage and $device->ip eq $qdev->ip; }