Changeset 764 for trunk/cgi-bin


Ignore:
Timestamp:
07/30/15 16:59:30 (9 years ago)
Author:
Kris Deugau
Message:

/trunk

  • Shuffle a couple of variable declarations up so we can do a necessary rDNS change in the event of "merge with reserved space" in updateBlock()
  • Put a fence on a "DELETE ... IN ()" so that it only runs if we actually have something to put in the IN clause
File:
1 edited

Legend:

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

    r759 r764  
    17621762  $sql .= join " = ?, ", @fieldlist;
    17631763
     1764  # create these here so we can use the expanded CIDR in the rDNS update after the eval,
     1765  # if we're expanding the block into a "reserved" freeblock
     1766  my $cidr = NetAddr::IP->new($binfo->{block});
     1767  my $newblock = NetAddr::IP->new($cidr->addr, $cidr->masklen - 1)->network;
     1768
    17641769  eval {
    17651770    # check for block merge first...
    17661771    if ($args{fbmerge}) {
    1767       my $cidr = NetAddr::IP->new($binfo->{block});
    1768       my $newblock = NetAddr::IP->new($cidr->addr, $cidr->masklen - 1)->network;
    17691772      # safety net?  make sure mergeable block passed in is really one or both of
    17701773      # a) reserved for expansion of the block and
     
    18421845    # and the per-IP set, if there is one.
    18431846    _rpc('updateRevSet', %{$args{iprev}}, rpcuser => $args{user}) if keys (%{$args{iprev}});
     1847
     1848    # and fix up the template's CIDR if required
     1849    _rpc('resizeTemplate', oldcidr => "$binfo->{block}", newcidr => $newblock->network.'', rpcuser => $args{user})
     1850        if $args{fbmerge};
    18441851  }
    18451852
     
    19972004    } # for (... @newblocks)
    19982005
    1999     $dbh->do("DELETE FROM freeblocks WHERE id IN (".join(',', keys %fbdel).")");
     2006    $dbh->do("DELETE FROM freeblocks WHERE id IN (".join(',', keys %fbdel).")") if %fbdel;
    20002007
    20012008    $dbh->commit;
Note: See TracChangeset for help on using the changeset viewer.