avoid undefined warning
This commit is contained in:
@@ -88,8 +88,8 @@ sub _snmp_connect_generic {
|
|||||||
my $comm_type = pop;
|
my $comm_type = pop;
|
||||||
my @communities = @{ setting($comm_type) || []};
|
my @communities = @{ setting($comm_type) || []};
|
||||||
unshift @communities, $device->snmp_comm
|
unshift @communities, $device->snmp_comm
|
||||||
if length $device->snmp_comm
|
if defined $device->snmp_comm
|
||||||
and length $comm_type and $comm_type eq 'community';
|
and defined $comm_type and $comm_type eq 'community';
|
||||||
|
|
||||||
my $info = undef;
|
my $info = undef;
|
||||||
VERSION: foreach my $ver (@versions) {
|
VERSION: foreach my $ver (@versions) {
|
||||||
@@ -123,7 +123,7 @@ sub _try_connect {
|
|||||||
$info = $class->new(%$snmp_args, Version => $ver, Community => $comm);
|
$info = $class->new(%$snmp_args, Version => $ver, Community => $comm);
|
||||||
undef $info unless (
|
undef $info unless (
|
||||||
(not defined $info->error)
|
(not defined $info->error)
|
||||||
and length $info->uptime
|
and defined $info->uptime
|
||||||
and ($info->layers or $info->description)
|
and ($info->layers or $info->description)
|
||||||
and $info->class
|
and $info->class
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user