# HG changeset patch # User Heiko Schlittermann (JUMPER) # Date 1400838396 -7200 # Node ID 5923d15fd57b1b3adfb73271d077a90eba54a3be # Parent 286a373ab86b7c62b732dbee16be7047c9391204 check the soa record! diff -r 286a373ab86b -r 5923d15fd57b bin/dnsvi --- a/bin/dnsvi Thu May 22 23:34:23 2014 +0200 +++ b/bin/dnsvi Fri May 23 11:46:36 2014 +0200 @@ -3,7 +3,7 @@ use 5.010; use strict; use warnings; -use if $ENV{DEBUG}//'' eq 'vidns' => 'Smart::Comments'; +use if $ENV{DEBUG}//'' eq 'dnsvi' => 'Smart::Comments'; use File::Temp; use Getopt::Long; use Pod::Usage; @@ -46,8 +46,13 @@ my @zone2 = parse(<$tmp>); my ($add, $del) = delta(\@zone1, \@zone2); - my @cmds = ((map { "update add $_" } @$add), - (map { "update delete $_" } @$del)); + my $orig_soa = (grep { $_->{rrtype} eq 'SOA' } map { $_->{rrset} } @zone1)[0]; + + my @cmds = ( + # 'prereq yxrrset {domain-name} [class] {type} {data…', + "prereq yxrrset @{$orig_soa}{qw{label rrtype data}}", + (map { "update add $_" } @$add), + (map { "update delete $_" } @$del)); print <<_EOF, join "\n" => @cmds, ''; # The following commands are about to be sent via nsupdate @@ -61,7 +66,8 @@ exec @nsupdate; die "Can't exec @nsupdate: $!\n"; }; - print $nsupdate join "\n", @cmds, 'send', ''; + say $nsupdate join "\n", @cmds, + 'show', 'send', 'answer'; close($nsupdate); say "nsupdate returned $?"; return 0; diff -r 286a373ab86b -r 5923d15fd57b lib/DNS/Vi.pm --- a/lib/DNS/Vi.pm Thu May 22 23:34:23 2014 +0200 +++ b/lib/DNS/Vi.pm Fri May 23 11:46:36 2014 +0200 @@ -1,7 +1,7 @@ use 5.010; use strict; use warnings; -use if $ENV{DEBUG}//'' eq 'vidns' => 'Smart::Comments'; +use if $ENV{DEBUG}//'' eq 'dnsvi' => 'Smart::Comments'; use Digest::SHA qw(sha512_hex); use base 'Exporter';