Changeset 699


Ignore:
Timestamp:
02/20/15 18:15:14 (10 years ago)
Author:
Kris Deugau
Message:

/trunk

Fix snafu in initPool(); forgot to set master_id

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r698 r699  
    12371237  # Retrieve some odds and ends for defaults on the IPs
    12381238  my ($pcustid) = $dbh->selectrow_array("SELECT def_custid FROM alloctypes WHERE type=?", undef, ($type) );
    1239   my ($vrf,$vlan) = $dbh->selectrow_array("SELECT vrf,vlan FROM allocations WHERE id = ?",
     1239  my ($vrf,$vlan,$master) = $dbh->selectrow_array("SELECT vrf,vlan,master_id FROM allocations WHERE id = ?",
    12401240        undef, ($parent) );
    12411241
     
    12521252  eval {
    12531253    # have to insert all pool IPs into poolips table as "unallocated".
    1254     $sth = $dbh->prepare("INSERT INTO poolips (ip,custid,city,type,parent_id) VALUES (?,?,?,?,?)");
     1254    $sth = $dbh->prepare("INSERT INTO poolips (ip,custid,city,type,parent_id,master_id) VALUES (?,?,?,?,?,?)");
    12551255
    12561256    # in case of pool extension by some means, we need to see what IPs were already inserted
     
    12881288      my $baseip = $poolip_list[$i]->addr;
    12891289      if ($baseip !~ /\.(?:0|255)$/ && !$foundips{$poolip_list[$i]}) {
    1290         $sth->execute($baseip, $pcustid, $city, $type, $parent);
     1290        $sth->execute($baseip, $pcustid, $city, $type, $parent, $master);
    12911291      }
    12921292    }
     
    12961296    if ($class eq 'all') { # (DSL-ish block - *all* IPs available
    12971297      if ($pool->addr !~ /\.0$/) {      # .0 causes weirdness.
    1298         $sth->execute($pool->addr, $pcustid, $city, $type, $parent) unless $foundips{$pool->addr};
    1299       }
    1300       $sth->execute($poolip_list[0]->addr, $pcustid, $city, $type, $parent) unless $foundips{$poolip_list[0]};
     1298        $sth->execute($pool->addr, $pcustid, $city, $type, $parent, $master) unless $foundips{$pool->addr};
     1299      }
     1300      $sth->execute($poolip_list[0]->addr, $pcustid, $city, $type, $parent, $master) unless $foundips{$poolip_list[0]};
    13011301      $pool--;
    13021302      if ($pool->addr !~ /\.255$/) {    # .255 can cause weirdness.
    1303         $sth->execute($pool->addr, $pcustid, $city, $type, $parent) unless $foundips{$pool->addr};
     1303        $sth->execute($pool->addr, $pcustid, $city, $type, $parent, $master) unless $foundips{$pool->addr};
    13041304      }
    13051305    }
Note: See TracChangeset for help on using the changeset viewer.