needed to test if the master changed, too
This commit is contained in:
@ -30,8 +30,10 @@ sub parse_slavefile {
|
|||||||
|
|
||||||
open(my $fh, $f) || die "Can't open $f: $!";
|
open(my $fh, $f) || die "Can't open $f: $!";
|
||||||
while (<$fh>) {
|
while (<$fh>) {
|
||||||
if (/^zone\s+\"([^\"]+)\"\s+\{/) {
|
if (/^zone\s+\"([^\"]+)\"\s+\{.+masters\s?\{\s?([^;]+);/) {
|
||||||
push ( @ret, { zone => $1 } );
|
push ( @ret, { zone => $1,
|
||||||
|
master => $2
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return @ret;
|
return @ret;
|
||||||
@ -40,6 +42,9 @@ sub parse_slavefile {
|
|||||||
sub do_rewrite {
|
sub do_rewrite {
|
||||||
my (@vh) = @_;
|
my (@vh) = @_;
|
||||||
my ($fh, $path) = tempfile();
|
my ($fh, $path) = tempfile();
|
||||||
|
|
||||||
|
print "Differences found; rewriting slave file.\n";
|
||||||
|
|
||||||
foreach my $i (sort {$a->{zone} cmp $b->{zone}} @vh) {
|
foreach my $i (sort {$a->{zone} cmp $b->{zone}} @vh) {
|
||||||
print $fh "zone \"$i->{zone}\" { type slave; file \"/var/cache/bind/db.$i->{zone}\"; masters { $i->{master}; }; };\n";
|
print $fh "zone \"$i->{zone}\" { type slave; file \"/var/cache/bind/db.$i->{zone}\"; masters { $i->{master}; }; };\n";
|
||||||
}
|
}
|
||||||
@ -55,7 +60,9 @@ sub contains_zone {
|
|||||||
|
|
||||||
foreach my $i (@zl) {
|
foreach my $i (@zl) {
|
||||||
return 1
|
return 1
|
||||||
if ($i->{zone} eq $zone);
|
if ($i->{zone} eq $zone->{zone} &&
|
||||||
|
$i->{master} eq $zone->{master}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user