Merge branch 'master' into og-api-tokens-simple

This commit is contained in:
Oliver Gorwits
2019-03-15 12:31:52 +00:00
19 changed files with 309 additions and 59 deletions

View File

@@ -63,7 +63,23 @@ sub fixup_device_auth {
die "error: config: stanza in device_auth must have a tag\n"
if not $stanza->{tag} and exists $stanza->{user};
push @new_stanzas, $stanza
push @new_stanzas, $stanza;
}
# import legacy sshcollector configuration
my $sshcollector = (setting('sshcollector') || []);
foreach my $stanza (@$sshcollector) {
# defaults
$stanza->{driver} = 'cli';
$stanza->{read} = 1;
$stanza->{no} ||= [];
# fixups
$stanza->{only} ||= [ scalar delete $stanza->{ip} ||
scalar delete $stanza->{hostname} ];
$stanza->{username} = scalar delete $stanza->{user};
push @new_stanzas, $stanza;
}
# legacy config

View File

@@ -219,7 +219,7 @@ Returns true if the C<$port> L<DBIx::Class> object has a phone connected.
=cut
sub port_has_phone {
return (shift)->with_properties->remote_is_phone;
return (shift)->properties->remote_is_phone;
}
1;

View File

@@ -100,11 +100,19 @@ sub snmp_comm_reindex {
}
$prefix ||= 'vlan-';
debug
sprintf '[%s] reindexing to "%s%s" (ver: %s, class: %s)',
if ($vlan =~ /^[0-9]+$/i && $vlan) {
debug sprintf '[%s] reindexing to "%s%s" (ver: %s, class: %s)',
$device->ip, $prefix, $vlan, $ver, $snmp->class;
$vlan ? $snmp->update(Context => ($prefix . $vlan))
: $snmp->update(Context => '');
$snmp->update(Context => ($prefix . $vlan));
} elsif ($vlan =~ /^[a-z0-9]+$/i && $vlan) {
debug sprintf '[%s] reindexing to "%s" (ver: %s, class: %s)',
$device->ip, $vlan, $ver, $snmp->class;
$snmp->update(Context => ($vlan));
} else {
debug sprintf '[%s] reindexing without context (ver: %s, class: %s)',
$device->ip, $ver, $snmp->class;
$snmp->update(Context => '');
}
}
else {
my $comm = $snmp->snmp_comm;