From 5653cb8bbe3013610496ce8e3bf0dc232db1dce9 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Tue, 21 Nov 2023 15:49:43 +0000 Subject: [PATCH] #1127 uninitialized value in Worker/Plugin/Discover/Entities.pm line 109 --- lib/App/Netdisco/Worker/Plugin/Discover/Entities.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/App/Netdisco/Worker/Plugin/Discover/Entities.pm b/lib/App/Netdisco/Worker/Plugin/Discover/Entities.pm index fe2cc9d4..85e9f3d6 100644 --- a/lib/App/Netdisco/Worker/Plugin/Discover/Entities.pm +++ b/lib/App/Netdisco/Worker/Plugin/Discover/Entities.pm @@ -100,13 +100,13 @@ register_worker({ phase => 'main', driver => 'snmp' }, sub { } foreach my $m (@modules){ - unless (!$m->{parent} || $seen_idx{$m->{parent}}){ + if ($m->{parent} and not exists $seen_idx{ $m->{parent} }){ # Some combined devices like Nexus with FEX or ASR with Satellites can return invalid # EntityMIB trees. This workaround relocates entitites with invalid parents to the root # of the tree, so they are at least visible in the Modules tab (see #710) info sprintf ' [%s] Entity %s (%s) has invalid parent %s - attaching as root entity instead', - $device->ip, $m->{index}, $m->{name}, $m->{parent}; + $device->ip, ($m->{index} || '"unknown index"'), ($m->{name} || '"unknown name"'), $m->{parent}; $m->{parent} = undef; } }