#591 domain_suffix can be list and supports (simple) regexp

Squashed commit of the following:

commit 975e4c6afc
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Tue Sep 3 13:35:26 2019 +0100

    also support regexp in domain_suffix

commit 0a2b5c8fa2
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Tue Sep 3 13:17:17 2019 +0100

    fix rancid, graph, and nodemonitor

commit 6d881de3ff
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Tue Sep 3 13:11:54 2019 +0100

    improve docs and set default domain_suffix to be list

commit 1dcafc08a8
Merge: 9a752e02 14ac69dc
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Tue Sep 3 13:00:39 2019 +0100

    Merge branch 'master' into og-multiple-domain-suffix

commit 9a752e0298
Merge: c836619f 82a99ea9
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Tue Sep 3 09:45:25 2019 +0100

    Merge branch 'master' into og-multiple-domain-suffix

commit c836619f8c
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Thu Jun 13 07:52:45 2019 +0100

    hokey fix for nodes with domains

commit fed14bd810
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Thu Jun 13 07:02:09 2019 +0100

    basic implementation, rancid graph and nodemonitor missing
This commit is contained in:
Oliver Gorwits
2019-09-03 13:35:43 +01:00
parent 14ac69dc2e
commit 542837d266
12 changed files with 58 additions and 25 deletions

View File

@@ -121,9 +121,9 @@ sub make_node_infostring {
sub make_link_infostring {
my $link = shift or return '';
my $domain = quotemeta( setting('domain_suffix') || '' );
(my $left_name = lc($link->{left_dns} || $link->{left_name} || $link->{left_ip})) =~ s/$domain$//;
(my $right_name = lc($link->{right_dns} || $link->{right_name} || $link->{right_ip})) =~ s/$domain$//;
my $domains = setting('domain_suffix');
(my $left_name = lc($link->{left_dns} || $link->{left_name} || $link->{left_ip})) =~ s/$domains//;
(my $right_name = lc($link->{right_dns} || $link->{right_name} || $link->{right_ip})) =~ s/$domains//;
my @zipped = List::MoreUtils::zip6
@{$link->{left_port}}, @{$link->{left_descr}},
@@ -163,7 +163,7 @@ ajax '/ajax/data/device/netmap' => require_login sub {
my %logvals = ();
my %metadata = ();
my %data = ( nodes => [], links => [] );
my $domain = quotemeta( setting('domain_suffix') || '' );
my $domains = setting('domain_suffix');
# LINKS
@@ -236,7 +236,7 @@ ajax '/ajax/data/device/netmap' => require_login sub {
keys %{ setting('host_group_displaynames') || {} };
++$logvals{ $device->get_column('log') || 1 };
(my $name = lc($device->dns || $device->name || $device->ip)) =~ s/$domain$//;
(my $name = lc($device->dns || $device->name || $device->ip)) =~ s/$domains//;
my %color_lkp = (
speed => (($device->get_column('log') || 1) * 1000),