From 97f40539e9769b6d68f7403328cc11415c7149b4 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sun, 11 Dec 2022 16:37:21 +0000 Subject: [PATCH] update num_ports to number of actually stored interfaces also change update_or_insert to just update as the code never runs unless in_storage anyway --- lib/App/Netdisco/Worker/Plugin/Discover/Properties.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/App/Netdisco/Worker/Plugin/Discover/Properties.pm b/lib/App/Netdisco/Worker/Plugin/Discover/Properties.pm index c479beca..7ac0df5a 100644 --- a/lib/App/Netdisco/Worker/Plugin/Discover/Properties.pm +++ b/lib/App/Netdisco/Worker/Plugin/Discover/Properties.pm @@ -364,6 +364,9 @@ register_worker({ phase => 'early', driver => 'snmp' }, sub { } } + # update num_ports + $device->num_ports( scalar values %deviceports ); + # support for Hooks vars->{'hook_data'}->{'ports'} = [values %deviceports]; @@ -371,7 +374,10 @@ register_worker({ phase => 'early', driver => 'snmp' }, sub { my $gone = $device->ports->delete({keep_nodes => 1}); debug sprintf ' [%s] interfaces - removed %d interfaces', $device->ip, $gone; - $device->update_or_insert(undef, {for => 'update'}); + + # uptime and num_ports changed + $device->update(); + $device->ports->populate([values %deviceports]); return Status->info(sprintf ' [%s] interfaces - added %d new interfaces',