Changeset 184 for trunk


Ignore:
Timestamp:
12/06/11 12:27:35 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Patch up some glitches in the VegaDNS import script - Vega doesn't
have separate default records for subgroups as I expected.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/vega-import.pl

    r172 r184  
    8181my $recget = $vegadbh->prepare("SELECT record_id,host,type,val,distance,weight,port,ttl,description ".
    8282        "FROM records WHERE domain_id=?");
    83 my $defrecget = $vegadbh->prepare("SELECT record_id, group_id, host, type, val, distance, weight, port, ttl, ".
     83my $defrecget = $vegadbh->prepare("SELECT group_id, host, type, val, distance, weight, port, ttl, ".
    8484        "description FROM default_records WHERE group_id=?");
    8585
     
    101101my $newrec = $newdbh->prepare("INSERT INTO records (domain_id,record_id,host,type,val,distance,weight,port,".
    102102        "ttl,description) VALUES (?,?,?,?,?,?,?,?,?,?)");
    103 my $newdefrec = $newdbh->prepare("INSERT INTO default_records (record_id,group_id,host,type,val,distance,".
    104         "weight,port,ttl,description) VALUES (?,?,?,?,?,?,?,?,?,?)");
     103my $newdefrec = $newdbh->prepare("INSERT INTO default_records (group_id,host,type,val,distance,".
     104        "weight,port,ttl,description) VALUES (?,?,?,?,?,?,?,?,?)");
    105105
    106106my $foo = qq(
     
    202202 ## Default records
    203203  print " default records: ";
    204   $defrecget->execute($grpid);
     204  $defrecget->execute(1);       # Vega 1.1.5/1.1.6 do not have default records for all groups;
     205                                # there is only support for one set of default records coded.
    205206  while (my @rec = $defrecget->fetchrow_array) {
    206     $rec[3] = $reverse_typemap{$vegatypes{$rec[3]}};
     207    $rec[0] = $grpid;
     208    $rec[2] = $reverse_typemap{$vegatypes{$rec[2]}};
     209    $rec[4] = 0 if !$rec[4];
    207210    $rec[5] = 0 if !$rec[5];
    208211    $rec[6] = 0 if !$rec[6];
    209     $rec[7] = 0 if !$rec[7];
    210212    $newdefrec->execute(@rec);
    211213  }
Note: See TracChangeset for help on using the changeset viewer.