diff --git a/Netdisco/Changes b/Netdisco/Changes index b1080230..dd592779 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -1,3 +1,9 @@ +2.033004 - 2015-11-16 + + [BUG FIXES] + + * snmpretries setting not working if unset (S. Xu) + 2.033003 - 2015-10-04 [ENHANCEMENTS] diff --git a/Netdisco/lib/App/Netdisco/Util/SNMP.pm b/Netdisco/lib/App/Netdisco/Util/SNMP.pm index 754a00ec..417f49f2 100644 --- a/Netdisco/lib/App/Netdisco/Util/SNMP.pm +++ b/Netdisco/lib/App/Netdisco/Util/SNMP.pm @@ -66,7 +66,9 @@ sub _snmp_connect_generic { my %snmp_args = ( AutoSpecify => 0, DestHost => $device->ip, - Retries => (setting('snmpretries') || 2), + # 0 is falsy. Using || with snmpretries equal to 0 will set retries to 2. + # check if the setting is 0. If not, use the default value of 2. + Retries => (setting('snmpretries') || setting('snmpretries') == 0 ? 0 : 2), Timeout => (setting('snmptimeout') || 1000000), NonIncreasing => (setting('nonincreasing') || 0), BulkWalk => ((defined setting('bulkwalk_off') && setting('bulkwalk_off'))