pf-tools/pf-tools: retour des shortname dans la zon pour le roun...
parmelan-guest at users.alioth.debian.org
parmelan-guest at users.alioth.debian.org
Tue Apr 8 11:15:49 UTC 2014
details: http://hg.debian.org/hg/pf-tools/pf-tools/rev/502a1da44cf0
changeset: 1254:502a1da44cf0
user: shad
date: Tue Apr 08 13:15:44 2014 +0200
description:
retour des shortname dans la zon pour le roundrobin
diffstat:
lib/PFTools/Conf/Host.pm | 45 +++++++++++++++++++++++++++++++--------------
t/13.conf.t | 24 ++++++++++++++++++++++++
t/20.files.t | 12 ++++++++++++
3 files changed, 67 insertions(+), 14 deletions(-)
diffs (151 lines):
diff -r 024855a2858e -r 502a1da44cf0 lib/PFTools/Conf/Host.pm
--- a/lib/PFTools/Conf/Host.pm Mon Apr 07 19:15:02 2014 +0200
+++ b/lib/PFTools/Conf/Host.pm Tue Apr 08 13:15:44 2014 +0200
@@ -1276,25 +1276,42 @@
$zone_entry->{$hostclass}->{'number'} = $number;
# host without %% where hostname is always eq shortname
- if ( $shortname eq $hostname and $shortname_vlan eq $vlan ) {
- $zone_entry->{$hostclass}->{$hostname} = qq{CNAME\t$hostname.$vlan};
- }
- if ( $shortname ne $hostname and $shortname_vlan eq $vlan ) {
- if ( not $zone_entry->{$hostclass}->{"$shortname\.$vlan"} ) {
- $zone_entry->{$hostclass}->{"$shortname\.$vlan"}
- = [ "A\t$zone_ip", ];
-
+ if ( $shortname eq $hostname ) {
+ if ( $shortname_vlan eq $vlan ) {
$zone_entry->{$hostclass}->{$hostname}
= qq{CNAME\t$hostname.$vlan};
}
+ }
+ else {
+ if ( $shortname_vlan ne $vlan ) {
+
+ # round robin on the shortname
+ if ( not $zone_entry->{$hostclass}->{"$shortname\.$vlan"} ) {
+ $zone_entry->{$hostclass}->{"$shortname\.$vlan"}
+ = [ "A\t$zone_ip", ];
+ }
+ else {
+ push @{ $zone_entry->{$hostclass}->{"$shortname\.$vlan"} },
+ qq{A\t$zone_ip};
+ }
+ }
else {
- push @{ $zone_entry->{$hostclass}->{"$shortname\.$vlan"} },
- qq{A\t$zone_ip};
- $zone_entry->{$hostclass}->{$shortname}
- = qq{CNAME\t$shortname.$vlan};
+ if ( not $zone_entry->{$hostclass}->{"$shortname\.$vlan"} ) {
+ $zone_entry->{$hostclass}->{"$shortname\.$vlan"}
+ = [ "A\t$zone_ip", ];
- $zone_entry->{$hostclass}->{$hostname}
- = qq{CNAME\t$hostname.$vlan};
+ $zone_entry->{$hostclass}->{$hostname}
+ = qq{CNAME\t$hostname.$vlan};
+ }
+ else {
+ push @{ $zone_entry->{$hostclass}->{"$shortname\.$vlan"} },
+ qq{A\t$zone_ip};
+ $zone_entry->{$hostclass}->{$shortname}
+ = qq{CNAME\t$shortname.$vlan};
+
+ $zone_entry->{$hostclass}->{$hostname}
+ = qq{CNAME\t$hostname.$vlan};
+ }
}
}
diff -r 024855a2858e -r 502a1da44cf0 t/13.conf.t
--- a/t/13.conf.t Mon Apr 07 19:15:02 2014 +0200
+++ b/t/13.conf.t Tue Apr 08 13:15:44 2014 +0200
@@ -1290,6 +1290,10 @@
'cbv4-spawn00.vlan-pfds-ext' => 'A 192.168.1.97',
'number' => 2,
'comment' => 'Spawning server',
+ 'cbv4-spawn.vlan-pfds-ext' => [
+ 'A 192.168.1.97',
+ 'A 192.168.1.98',
+ ],
},
'vip-spawn' => {
'vip-spawn.vlan-pfds-ext' => 'A 192.168.1.99',
@@ -1314,6 +1318,10 @@
'cbv4-rdeploy01.vlan-public' => 'A 80.125.163.43',
'number' => 2,
'comment' => 'Rdeploy server',
+ 'cbv4-rdeploy.vlan-public' => [
+ 'A 80.125.163.42',
+ 'A 80.125.163.43',
+ ],
},
},
'BY_SITE' => {
@@ -1366,6 +1374,18 @@
'A 10.1.167.0',
'A 10.1.167.1',
],
+ 'cbv4-spawn.vlan-admindsi' => [
+ 'A 10.3.1.41',
+ 'A 10.3.1.42',
+ ],
+ 'cbv4-spawn.vlan-pfds-int' => [
+ 'A 10.2.167.0',
+ 'A 10.2.167.1',
+ ],
+ 'cbv4-spawn.vlan-middledsi' => [
+ 'A 10.3.2.41',
+ 'A 10.3.2.42',
+ ],
'spawn01' => 'CNAME cbv4-spawn01.vlan-systeme',
'cbv4-spawn01.vlan-systeme' => 'A 10.1.167.1',
'cbv4-spawn00.vlan-pfds-int' => 'A 10.2.167.0',
@@ -1379,6 +1399,10 @@
'cbv4-pfds-filer01.vlan-systeme' => 'A 10.1.2.1',
'number' => 2,
'comment' => 'NAS for CBV4-PFDS site',
+ 'cbv4-pfds-filer.vlan-systeme' => [
+ 'A 10.1.2.0',
+ 'A 10.1.2.1',
+ ],
},
'vlan-systeme' => {
'broadcast' => 'A 10.1.255.255',
diff -r 024855a2858e -r 502a1da44cf0 t/20.files.t
--- a/t/20.files.t Mon Apr 07 19:15:02 2014 +0200
+++ b/t/20.files.t Tue Apr 08 13:15:44 2014 +0200
@@ -189,6 +189,8 @@
q{; cbv4-pfds-filer: NAS for CBV4-PFDS site},
q{; number: 2},
q{;----------------------------------------------------------------------------},
+ qq{cbv4-pfds-filer.vlan-systeme\tIN A\t10.1.2.0},
+ qq{cbv4-pfds-filer.vlan-systeme\tIN A\t10.1.2.1},
qq{cbv4-pfds-filer00.vlan-systeme\tIN A\t10.1.2.0},
qq{cbv4-pfds-filer01.vlan-systeme\tIN A\t10.1.2.1},
q{},
@@ -196,6 +198,14 @@
q{; number: 2},
q{;----------------------------------------------------------------------------},
qq{cbv4-spawn\tIN CNAME\tcbv4-spawn.vlan-systeme},
+ qq{cbv4-spawn.vlan-admindsi\tIN A\t10.3.1.41},
+ qq{cbv4-spawn.vlan-admindsi\tIN A\t10.3.1.42},
+ qq{cbv4-spawn.vlan-middledsi\tIN A\t10.3.2.41},
+ qq{cbv4-spawn.vlan-middledsi\tIN A\t10.3.2.42},
+ qq{cbv4-spawn.vlan-pfds-ext\tIN A\t192.168.1.97},
+ qq{cbv4-spawn.vlan-pfds-ext\tIN A\t192.168.1.98},
+ qq{cbv4-spawn.vlan-pfds-int\tIN A\t10.2.167.0},
+ qq{cbv4-spawn.vlan-pfds-int\tIN A\t10.2.167.1},
qq{cbv4-spawn.vlan-systeme\tIN A\t10.1.167.0},
qq{cbv4-spawn.vlan-systeme\tIN A\t10.1.167.1},
qq{cbv4-spawn00\tIN CNAME\tcbv4-spawn00.vlan-systeme},
@@ -220,6 +230,8 @@
q{; cbv4-rdeploy: Rdeploy server},
q{; number: 2},
q{;----------------------------------------------------------------------------},
+ qq{cbv4-rdeploy.vlan-public\tIN A\t80.125.163.42},
+ qq{cbv4-rdeploy.vlan-public\tIN A\t80.125.163.43},
qq{cbv4-rdeploy00.vlan-public\tIN A\t80.125.163.42},
qq{cbv4-rdeploy01.vlan-public\tIN A\t80.125.163.43},
q{},
More information about the pf-tools-commits
mailing list