import legacy sshcollector config
This commit is contained in:
@@ -84,6 +84,7 @@ if ((setting('snmp_auth') and 0 == scalar @{ setting('snmp_auth') })
|
|||||||
config->{'community_rw'} = [ @{setting('community_rw')}, 'private' ];
|
config->{'community_rw'} = [ @{setting('community_rw')}, 'private' ];
|
||||||
}
|
}
|
||||||
# fix up device_auth (or create it from old snmp_auth and community settings)
|
# fix up device_auth (or create it from old snmp_auth and community settings)
|
||||||
|
# also imports legacy sshcollcetor config
|
||||||
config->{'device_auth'}
|
config->{'device_auth'}
|
||||||
= [ App::Netdisco::Util::DeviceAuth::fixup_device_auth() ];
|
= [ App::Netdisco::Util::DeviceAuth::fixup_device_auth() ];
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,23 @@ sub fixup_device_auth {
|
|||||||
die "error: config: stanza in device_auth must have a tag\n"
|
die "error: config: stanza in device_auth must have a tag\n"
|
||||||
if not $stanza->{tag} and exists $stanza->{user};
|
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
|
# legacy config
|
||||||
|
|||||||
Reference in New Issue
Block a user