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: $!";
|
||||
while (<$fh>) {
|
||||
if (/^zone\s+\"([^\"]+)\"\s+\{/) {
|
||||
push ( @ret, { zone => $1 } );
|
||||
if (/^zone\s+\"([^\"]+)\"\s+\{.+masters\s?\{\s?([^;]+);/) {
|
||||
push ( @ret, { zone => $1,
|
||||
master => $2
|
||||
} );
|
||||
}
|
||||
}
|
||||
return @ret;
|
||||
@ -40,6 +42,9 @@ sub parse_slavefile {
|
||||
sub do_rewrite {
|
||||
my (@vh) = @_;
|
||||
my ($fh, $path) = tempfile();
|
||||
|
||||
print "Differences found; rewriting slave file.\n";
|
||||
|
||||
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";
|
||||
}
|
||||
@ -55,7 +60,9 @@ sub contains_zone {
|
||||
|
||||
foreach my $i (@zl) {
|
||||
return 1
|
||||
if ($i->{zone} eq $zone);
|
||||
if ($i->{zone} eq $zone->{zone} &&
|
||||
$i->{master} eq $zone->{master}
|
||||
);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user