fixed regex
This commit is contained in:
@ -4,6 +4,7 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use Martnet::DDNS;
|
use Martnet::DDNS;
|
||||||
use File::Temp qw/tempfile/;
|
use File::Temp qw/tempfile/;
|
||||||
|
use Data::Dumper;
|
||||||
|
|
||||||
my $force = shift; # a "force" flag, if the update is big
|
my $force = shift; # a "force" flag, if the update is big
|
||||||
|
|
||||||
@ -14,12 +15,12 @@ my %vhh = map { $_->{zone} => 1 } @vh;
|
|||||||
|
|
||||||
my @all = parse_slavefile("/etc/bind/martnet.slave.zones.9");
|
my @all = parse_slavefile("/etc/bind/martnet.slave.zones.9");
|
||||||
my %allh = all_zones_hash(@all);
|
my %allh = all_zones_hash(@all);
|
||||||
use Data::Dumper;
|
|
||||||
|
|
||||||
# For each virtual host, see if we've got it already
|
# For each virtual host, see if we've got it already
|
||||||
my $changecount = 0;
|
my $changecount = 0;
|
||||||
foreach my $i (@vh) {
|
foreach my $i (@vh) {
|
||||||
unless (contains_zone($i, @all)) {
|
unless (contains_zone($i, @all)) {
|
||||||
|
print "don't have $i->{zone}\n";
|
||||||
$changecount++;
|
$changecount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,7 +46,7 @@ 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+\{.+masters\s?\{\s?([^;]+);/) {
|
if (/^zone\s+\"([^\"]+)\"\s+\{.+masters\s?\{\s?(.+);\s?\};\s?\};/) {
|
||||||
push ( @ret, { zone => $1,
|
push ( @ret, { zone => $1,
|
||||||
master => $2
|
master => $2
|
||||||
} );
|
} );
|
||||||
@ -85,6 +86,10 @@ sub contains_zone {
|
|||||||
my ($zone, @zl) = @_;
|
my ($zone, @zl) = @_;
|
||||||
|
|
||||||
foreach my $i (@zl) {
|
foreach my $i (@zl) {
|
||||||
|
if ($i->{zone} eq $zone->{zone}) {
|
||||||
|
print "m: '$i->{master}' ne '$zone->{master}'\n"
|
||||||
|
unless ($i->{master} eq $zone->{master});
|
||||||
|
}
|
||||||
return 1
|
return 1
|
||||||
if ($i->{zone} eq $zone->{zone} &&
|
if ($i->{zone} eq $zone->{zone} &&
|
||||||
$i->{master} eq $zone->{master}
|
$i->{master} eq $zone->{master}
|
||||||
|
|||||||
Reference in New Issue
Block a user