Changeset 822 for trunk/bind-import
- Timestamp:
- 12/04/20 13:30:21 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bind-import
r821 r822 31 31 32 32 my $dnsdb = new DNSDB; 33 33 34 my $dryrun = 0; 34 35 … … 140 141 if ($zid) { 141 142 die "zone $origzone already present, not merging records\n"; 142 #print "dbg: skip add domain\n";143 #print "dbg: skip add revzone\n"; 143 144 # $zname = new NetAddr::IP $zname; 144 145 # $zname = DNSDB::_ZONE($zname, 'ZONE', 'r', '.').($zname->{isv6} ? '.ip6.arpa' : '.in-addr.arpa'); … … 150 151 $zid = $dnsdb->domainID($zname,':ANY:'); 151 152 if ($zid) { 152 die "zone $origzone already present, not merging records\n";153 # die "zone $origzone already present, not merging records\n"; 153 154 #print "dbg: skip add domain\n"; 154 155 } 155 ($zid) = $dnsdb->{dbh}->selectrow_array("INSERT INTO domains (domain,group_id,status,default_location,zserial) VALUES (?,?,?,?,?) RETURNING domain_id",156 undef, ($zname, $group, $status, $location, $serial));156 # ($zid) = $dnsdb->{dbh}->selectrow_array("INSERT INTO domains (domain,group_id,status,default_location,zserial) VALUES (?,?,?,?,?) RETURNING domain_id", 157 # undef, ($zname, $group, $status, $location, $serial)); 157 158 158 159 } … … 205 206 206 207 $i++; 207 last if $i > 17;208 #last if $i > 17; 208 209 #print "line $i: ($rec)\n"; 209 210 if (my ($macro,$mdetail) = ($rec =~ /^\s*\$(TTL|ORIGIN|INCLUDE|GENERATE)\s+(.+)/) ) { … … 562 563 # unless ($dryrun) { 563 564 my ($code, $msg); 564 if ($rev eq 'n') { 565 ($code,$msg) = $dnsdb->addRec('n', $rev, $zid, \$curlabel, \$itype, \$rdata, $ttl, 566 $location, undef, undef, $distance, $weight, $port); 567 } else { 568 ($code,$msg) = $dnsdb->addRec('y', $rev, $zid, \$rdata, \$itype, \$curlabel, $ttl, 569 $location, undef, undef, $distance, $weight, $port); 570 } 565 566 # swap curlabel/rdata for revzones, because our internal metastorage only knows about "host" and "val" 567 # keep the originals Just In Case(TM) 568 $curlabel =~ s/\.$//; # dnsadmin doesn't store trailing dots 569 my $inshost = $curlabel; 570 my $insval = $rdata; 571 if ($rev eq 'y') { 572 $inshost = $rdata; 573 $insval = $curlabel; 574 } 575 print "dbg: maybeip next ($insval)\n"; 576 my $addr = NetAddr::IP->new($insval) if DNSDB::_maybeip(\$insval); 577 my $fields; 578 my @vallist; 579 580 ($code,$msg) = $validators{$itype}($dnsdb, defrec => 'n', revrec => $rev, id => $zid, 581 host => \$inshost, rectype => \$itype, val => \$insval, addr => $addr, 582 dist => \$distance, port => \$port, weight => \$weight, 583 fields => \$fields, vallist => \@vallist); 584 585 # Add standard common fields 586 $fields .= "host,type,val,ttl,".DNSDB::_recparent('n',$rev); 587 push @vallist, ($inshost,$itype,$insval,$ttl,$zid); 588 589 my $vallen = '?'.(',?'x$#vallist); 590 591 print "INSERT INTO records ($fields) VALUES ($vallen);\n".join("','", @vallist)."\n"; 592 593 # if ($rev eq 'n') { 594 # ($code,$msg) = $dnsdb->addRec('n', $rev, $zid, \$curlabel, \$itype, \$rdata, $ttl, 595 # $location, undef, undef, $distance, $weight, $port); 596 # } else { 597 # ($code,$msg) = $dnsdb->addRec('y', $rev, $zid, \$rdata, \$itype, \$curlabel, $ttl, 598 # $location, undef, undef, $distance, $weight, $port); 599 # } 571 600 print "$code: $msg\n" if $code ne 'OK'; 572 601 # }
Note:
See TracChangeset
for help on using the changeset viewer.