From 08b34e083db3a7c872ddced728c619796e3dc5e1 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sat, 7 Oct 2017 11:39:17 +0100 Subject: [PATCH] remove die() calls --- lib/App/Netdisco/Worker/Plugin/Arpnip/Subnets.pm | 2 +- lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm | 6 ++---- lib/App/Netdisco/Worker/Plugin/Macsuck/Nodes.pm | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/App/Netdisco/Worker/Plugin/Arpnip/Subnets.pm b/lib/App/Netdisco/Worker/Plugin/Arpnip/Subnets.pm index 5511c267..0dd6f256 100644 --- a/lib/App/Netdisco/Worker/Plugin/Arpnip/Subnets.pm +++ b/lib/App/Netdisco/Worker/Plugin/Arpnip/Subnets.pm @@ -34,7 +34,7 @@ sub gather_subnets { my @subnets = (); my $snmp = App::Netdisco::Transport::SNMP->reader_for($device) - or die "arpnip failed: could not SNMP connect to $device"; + or return (); # already checked! my $ip_netmask = $snmp->ip_netmask; foreach my $entry (keys %$ip_netmask) { diff --git a/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm b/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm index 7158ca63..65eed0e0 100644 --- a/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm +++ b/lib/App/Netdisco/Worker/Plugin/Discover/Neighbors.pm @@ -86,7 +86,7 @@ sub store_neighbors { my @to_discover = (); my $snmp = App::Netdisco::Transport::SNMP->reader_for($device) - or die "discover failed: could not SNMP connect to $device"; + or return (); # already checked! # first allow any manually configured topology to be set set_manual_topology($device); @@ -287,9 +287,7 @@ sub store_neighbors { # in the devices table. only use root_ips and skip any bad topo entries. sub set_manual_topology { my $device = shift; - - my $snmp = App::Netdisco::Transport::SNMP->reader_for($device) - or die "discover failed: could not SNMP connect to $device"; + my $snmp = App::Netdisco::Transport::SNMP->reader_for($device) or return; schema('netdisco')->txn_do(sub { # clear manual topology flags diff --git a/lib/App/Netdisco/Worker/Plugin/Macsuck/Nodes.pm b/lib/App/Netdisco/Worker/Plugin/Macsuck/Nodes.pm index 24fc23f8..488585c2 100644 --- a/lib/App/Netdisco/Worker/Plugin/Macsuck/Nodes.pm +++ b/lib/App/Netdisco/Worker/Plugin/Macsuck/Nodes.pm @@ -152,7 +152,7 @@ sub get_vlan_list { my $device = shift; my $snmp = App::Netdisco::Transport::SNMP->reader_for($device) - or die "macsuck failed: could not SNMP connect to $device"; + or return (); # already checked! return () unless $snmp->cisco_comm_indexing; @@ -269,7 +269,7 @@ sub walk_fwtable { my $cache = {}; my $snmp = App::Netdisco::Transport::SNMP->reader_for($device) - or die "macsuck failed: could not SNMP connect to $device"; + or return $cache; # already checked! my $fw_mac = $snmp->fw_mac; my $fw_port = $snmp->fw_port;