Changeset 820


Ignore:
Timestamp:
12/04/20 13:23:49 (3 years ago)
Author:
Kris Deugau
Message:

/trunk

Thirteenth sampled iteration of bind-import

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bind-import

    r819 r820  
    9696    open SKIP, "<$skipfile";
    9797    while (<SKIP>) {
     98      chomp;
    9899      push @skipdefs, $_;
    99100    }
     101    close SKIP;
    100102  } else {
    101103    warn "skipfile $skipfile requested but it doesn't seem to exist.  Continuing.\n";
     
    138140      $zname = DNSDB::_ZONE($zname, 'ZONE', 'r', '.').($zname->{isv6} ? '.ip6.arpa' : '.in-addr.arpa');
    139141    }
    140     $zid = $dnsdb->{dbh}->do("INSERT INTO revzones (revnet,group_id,status,default_location,zserial) VALUES (?,?,?,?,?) RETURNING rnds_id",
     142    ($zid) = $dnsdb->{dbh}->selectrow_array("INSERT INTO revzones (revnet,group_id,status,default_location,zserial) VALUES (?,?,?,?,?) RETURNING rnds_id",
    141143        undef, ($zname, $group, $status, $location, $serial));
    142144
     
    147149#      die "zone $origzone already present, not merging records\n";
    148150print "dbg: skip add domain\n";
    149     }
    150 else {
    151     $zid = $dnsdb->{dbh}->do("INSERT INTO domains (domain,group_id,status,default_location,zserial) VALUES (?,?,?,?,?) RETURNING domain_id",
     151    } else {
     152      ($zid) = $dnsdb->{dbh}->selectrow_array("INSERT INTO domains (domain,group_id,status,default_location,zserial) VALUES (?,?,?,?,?) RETURNING domain_id",
    152153        undef, ($zname, $group, $status, $location, $serial));
    153 }
     154    }
    154155
    155156  }
     
    184185                                # arguably should do some more targeted voodoo when parsing the SOA details
    185186
     187##fixme:  would prefer to break the loop below *AND* next; the while starting above
     188    # check skiplist.  do this early since it's (mostly) a simple string match against the raw record line
     189    my $skipflag = 0;
     190    foreach (@skipdefs) {
     191#print "skipdbg: $_ =~ $rec\n" if $rec =~ /207/;
     192      if ($rec =~ /\Q$_\E/) {
     193        $skipflag = 1;
     194#        print "skip: $rec\n";
     195      }
     196    }
     197    next if $skipflag;
     198
    186199##fixme:  use external skiplist
    187   # skip stale records that have no value
    188   next if /^ip-192-168-1(12|20)-\d+/;
    189   next if /ip.add.re.\d+\s*$/;
    190 
    191   $i++;
    192 last if $i > 7;
     200#  # skip stale records that have no value
     201#  next if /^ip-192-168-1(12|20)-\d+/;
     202#  next if /ip.add.re.\d+\s*$/;
     203
     204$i++;
     205last if $i > 17;
    193206#print "line $i: ($rec)\n";
    194207    if (my ($macro,$mdetail) = ($rec =~ /^\s*\$(TTL|ORIGIN|INCLUDE|GENERATE)\s+(.+)/) ) {
     
    236249    if ($rec =~ /^\s/) {
    237250      $curlabel = $prevlabel;
    238 print "  found empty label, using previous label\n";
     251#print "  found empty label, using previous label\n";
    239252    } else {
    240253      ($curlabel) = ($rec =~ /^([\w\@_.-]+)\s/);
    241254    }
    242255
    243 print "  found '$curlabel'\n";
     256#print "  found '$curlabel'\n";
    244257
    245258    # magic name!
     
    250263      $curlabel .= ($origin eq '.' ? '.' : ".$origin");
    251264    }
    252 print "  expanded '$curlabel'\n";
     265#print "  expanded '$curlabel'\n";
    253266
    254267# hack pthbptt
     
    476489#Zfqdn:mname:rname:ser:ref:ret:exp:min:ttl:timestamp:lo
    477490#print "Z$zname:$ns:$adminmail:$soabits[0]:$soabits[1]:$soabits[2]:$soabits[3]:$soabits[4]:$ttl\n";
     491      # skip insert at end of loop;  SOA records are not handled by DNSDB::addRec()
     492      next;
    478493    } # SOA
    479494
     
    556571          $location, undef, undef, $distance, $weight, $port);
    557572      }
    558       print "$code: $msg\n";
     573      print "$code: $msg\n" if $code ne 'OK';
    559574    }
    560575#  $i++;
Note: See TracChangeset for help on using the changeset viewer.