Changeset 853


Ignore:
Timestamp:
09/15/22 15:46:07 (2 years ago)
Author:
Kris Deugau
Message:

/trunk

BIND export, unwinding dev saves, 5 of many many

  • Refinement of zone-file-per-location assembly
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB/ExportBIND.pm

    r851 r853  
    6060
    6161
    62     # fetch a list of views/locations present in the zone.  we need to publish a file for each one.
    63     # in the event that no locations are present (~~ $viewlist is empty), /%view collapses to nothing in the zone path
    64     my (@loclist) = $self->{dbh}->selectrow_array("SELECT DISTINCT location FROM records WHERE rdns_id = ?", undef, $revid);
    65     push @loclist, $defloc unless grep /$defloc/, @loclist;
    66     my $zonepath = $self->{bind_export_zone_path};
    67     my %zonefiles;  # to be a list of file handles.
    68 ##fixme:  convert logical revzone into .arpa name
    69     foreach my $loc (@loclist) {
    70       my $zfilepath = $zonepath;
    71       $zonepath =~ s/\%view/$loc/;
    72       $zonepath =~ s/\%zone/$revzone/;
    73       # Just In Case(TM)
    74       $zonepath =~ s,[^\w./-],_,g;
    75       #open $zonefiles{$loc}, ">", $zfilepath;
    76 print "open zonefile for '$loc', '$zonepath'\n";
    77     }
    78 
    7962    eval {
    8063
     
    9073          $zonefilehandle = *ZONECACHE;
    9174        }
     75
     76        # fetch a list of views/locations present in the zone.  we need to publish a file for each one.
     77        # in the event that no locations are present (~~ $viewlist is empty), /%view collapses to nothing in the zone path
     78        my (@loclist) = $self->{dbh}->selectrow_array("SELECT DISTINCT location FROM records WHERE rdns_id = ?", undef, $revid);
     79        push @loclist, $defloc unless grep /$defloc/, @loclist;
     80        my $zonepath = $self->{bind_export_zone_path};
     81        my %zonefiles;  # to be a list of file handles.
     82##fixme:  convert logical revzone into .arpa name
     83        foreach my $loc (@loclist) {
     84          my $zfilepath = $zonepath;
     85          $zfilepath =~ s/\%view/$loc/;
     86          $zfilepath =~ s/\%zone/$revzone/;
     87          # Just In Case(TM)
     88          $zfilepath =~ s,[^\w./-],_,g;
     89          #open $zonefiles{$loc}, ">", $zfilepath;
     90print "open zonefile for '$loc', '$zfilepath'\n";
     91        }
     92
    9293
    9394        # need to fetch this separately since the rest of the records all (should) have real IPs in val
Note: See TracChangeset for help on using the changeset viewer.