From e42c2135c48c34b3107d215704d467c03388cbf4 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 30 Dec 2019 11:09:17 +0000 Subject: [PATCH] fix #686 makerancidconf excluded setting should be (ACL) list not dict --- Changes | 1 + .../Netdisco/Worker/Plugin/MakeRancidConf.pm | 43 ++++++++++--------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/Changes b/Changes index 277f23a9..ae59d0d5 100644 --- a/Changes +++ b/Changes @@ -16,6 +16,7 @@ * #667 neighbors map with VLAN filter should only consider configured ports * #676 remove vim settings from files * #679 uninitialised error + * #686 makerancidconf excluded setting should be (ACL) list not dict 2.044004 - 2019-10-30 diff --git a/lib/App/Netdisco/Worker/Plugin/MakeRancidConf.pm b/lib/App/Netdisco/Worker/Plugin/MakeRancidConf.pm index 4a4df71d..32ab43a1 100644 --- a/lib/App/Netdisco/Worker/Plugin/MakeRancidConf.pm +++ b/lib/App/Netdisco/Worker/Plugin/MakeRancidConf.pm @@ -52,9 +52,14 @@ register_worker({ phase => 'main' }, sub { $config->{groups} ||= { default => 'any' }; $config->{vendormap} ||= {}; - $config->{excluded} ||= {}; - $config->{by_ip} ||= {}; - $config->{by_hostname} ||= {}; + $config->{excluded} ||= []; + $config->{by_ip} ||= []; + $config->{by_hostname} ||= []; + + # fix #686 excluded setting should be (ACL) list not dict + if (ref {} eq ref $config->{excluded}) { + $config->{excluded} = [ values %{ $config->{excluded} } ]; + } my $routerdb = {}; while (my $d = $devices->next) { @@ -147,17 +152,17 @@ C. All keys are optional: down_age: '1 day' # default delimiter: ';' # default default_group: 'default' # default - excluded: - excludegroup1: 'host_group1_acl' - excludegroup2: 'host_group2_acl' groups: - groupname1: 'host_group3_acl' - groupname2: 'host_group4_acl' + groupname1: 'host_group1_acl' + groupname2: 'host_group2_acl' vendormap: - vname1: 'host_group5_acl' - vname2: 'host_group6_acl' - by_ip: 'host_group7_acl' - by_hostname: 'host_group8_acl' + vname1: 'host_group3_acl' + vname2: 'host_group4_acl' + excluded: + - 'host_group5_acl' + - 'another.host.example.com' + by_ip: 'host_group6_acl' + by_hostname: 'host_group7_acl' Note that the default directory for writing files is not F so you may wish to set this in C, (especially if migrating from the old @@ -216,14 +221,6 @@ be different from the default, the default is C<;>. Put devices into this group if they do not match any other groups defined. -=head2 C - -This dictionary defines a list of devices that you do not wish to export to -rancid configuration. - -The value should be a L -to select devices in the Netdisco database. - =head2 C This dictionary maps rancid group names with configuration which will match @@ -255,6 +252,12 @@ a good solution to use the correct device type. Example: vendormap: cisco-sb: 'group:grp-ciscosb' +=head2 C + +L +to identify devices that will be excluded from the rancid configuration. + =head2 C L