pf-tools/pf-tools: croak if an alias is duplicated, dont overwri...
parmelan-guest at users.alioth.debian.org
parmelan-guest at users.alioth.debian.org
Mon Apr 14 17:27:01 UTC 2014
details: http://hg.debian.org/hg/pf-tools/pf-tools/rev/59724ac97a6f
changeset: 1272:59724ac97a6f
user: shad
date: Mon Apr 14 19:26:51 2014 +0200
description:
croak if an alias is duplicated, dont overwrite dev and eth key when several ipv4.vlan-xxx.Y exist otherwise only the last declared exist in the zone file
diffstat:
lib/PFTools/Conf/Host.pm | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diffs (45 lines):
diff -r 89b6e8fa089b -r 59724ac97a6f lib/PFTools/Conf/Host.pm
--- a/lib/PFTools/Conf/Host.pm Fri Apr 11 16:51:36 2014 +0200
+++ b/lib/PFTools/Conf/Host.pm Mon Apr 14 19:26:51 2014 +0200
@@ -165,8 +165,8 @@
my $iface;
$iface
= $host_ref->{"link::$link"}
- ->{ 'dev.' . ( 0 + $hostnum ) } ||= $iface
- = $host_ref->{"link::$link"}->{'dev'};
+ ->{ 'dev.' . ( 0 + $hostnum ) }
+ ||= $host_ref->{"link::$link"}->{'dev'};
if ( !$iface ) {
carp
qq{WARNING no 'dev' section for '$hostname', maybe not enough interface on the server};
@@ -688,10 +688,10 @@
# FIXME this obviously does not handle IPv6
if ( $key_type =~ m{ \A ipv }xms ) {
my $suffix = $hostnum ? qq{\.$hostnum} : q{};
- $result->{qq{link::$spec}} = {
- qq{dev$suffix} => qq{eth$iface_index},
- qq{ipv4$suffix} => $server_ref->{$key},
- };
+ $result->{qq{link::$spec}}->{qq{dev$suffix}}
+ = qq{eth$iface_index};
+ $result->{qq{link::$spec}}->{qq{ipv4$suffix}}
+ = $server_ref->{$key};
$iface_index++;
next;
}
@@ -1346,6 +1346,15 @@
$host_part_ref->{$alias} = $shortname;
$host_part_ref->{ $alias . $index } = $hostname;
+ foreach my $subhost ( keys %{$zone_entry} ) {
+ if ( $hostclass ne $subhost
+ && ref( $zone_entry->{$subhost} ) eq q{HASH}
+ && defined $zone_entry->{$subhost}->{$alias} )
+ {
+ croak
+ qq{ERROR: alias '$alias' for '$hostname' already defined for host '$subhost'};
+ }
+ }
if ( $dns_def_ref->{$key} eq $vlan ) {
$zone_entry->{$hostclass}->{$alias}
= qq{CNAME\t$shortname\.$vlan};
More information about the pf-tools-commits
mailing list