From a43c98962ae7b88787f8960090ebbe86d61450f2 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 3 Jun 2013 20:37:39 +0100 Subject: [PATCH] Missing mibdirs causes all MIBs to be loaded (with a warning) --- Netdisco/Changes | 1 + Netdisco/lib/App/Netdisco/Util/SNMP.pm | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Netdisco/Changes b/Netdisco/Changes index 0f99ffd3..a5daeaae 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -27,6 +27,7 @@ * Buttons for discover/macsuck/arpnip on device details page * Support 'path' config option as alternative to --path /mountpoint * Local plugins can be placed in ${NETDISCO_HOME}/site_plugins/... + * Missing mibdirs causes all MIBs to be loaded (with a warning) [BUG FIXES] diff --git a/Netdisco/lib/App/Netdisco/Util/SNMP.pm b/Netdisco/lib/App/Netdisco/Util/SNMP.pm index e7f1964b..a2703288 100644 --- a/Netdisco/lib/App/Netdisco/Util/SNMP.pm +++ b/Netdisco/lib/App/Netdisco/Util/SNMP.pm @@ -149,7 +149,14 @@ sub _try_connect { sub _build_mibdirs { my $home = (setting('mibhome') || $ENV{NETDISCO_HOME} || $ENV{HOME}); return map { dir($home, $_) } - @{ setting('mibdirs') || [] }; + @{ setting('mibdirs') || _get_mibdirs_content($home) }; +} + +sub _get_mibdirs_content { + my $home = shift; + warning 'Netdisco SNMP work will be really slow - loading ALL MIBs. Please set mibdirs.'; + my @list = map {s|$home/||; $_} grep {-d} glob("$home/*"); + return \@list; } =head2 snmp_comm_reindex( $snmp, $vlan )