Ignore smmp_ver in DB when reconnecting to a device

This commit is contained in:
Oliver Gorwits
2014-01-06 20:47:36 +00:00
parent b45510ae8f
commit c615ba4df2
3 changed files with 13 additions and 3 deletions

View File

@@ -404,9 +404,10 @@ Net-SNMP 5.3 or higher.
=head3 C<snmpver>
Value: C<1|2|3>. Default: 2.
Value: C<1|2|3>. Default: 3.
Version of the SNMP protocol used when connecting to devices.
Highest version of the SNMP protocol used when connecting to devices. Use this
setting to disable SNMP v3 globally. Usually you don't need to configure this.
=head3 C<snmptimeout>

View File

@@ -98,7 +98,7 @@ sub _snmp_connect_generic {
# TODO: add version force support
# use existing SNMP version or try 3, 2, 1
my @versions = reverse (1 .. ($device->snmp_ver || setting('snmpver') || 3));
my @versions = reverse (1 .. (setting('snmpver') || 3));
# get the community string(s)
my @communities = _build_communities($device, $mode);
@@ -169,6 +169,10 @@ sub _try_read {
and $info->class
);
$device->in_storage
? $device->update({snmp_ver => $info->snmp_ver})
: $device->set_column(snmp_ver => $info->snmp_ver);
if ($comm->{community}) {
$device->in_storage
? $device->update({snmp_comm => $comm->{community}})
@@ -189,6 +193,10 @@ sub _try_write {
$info->set_location($loc) or return undef;
return undef unless ($loc eq $info->load_location);
$device->in_storage
? $device->update({snmp_ver => $info->snmp_ver})
: $device->set_column(snmp_ver => $info->snmp_ver);
# one of these two cols must be set
$device->update_or_create_related('community', {
($comm->{tag} ? (snmp_auth_tag => $comm->{tag}) : ()),