Changeset 849 for trunk


Ignore:
Timestamp:
04/13/16 18:03:15 (8 years ago)
Author:
Kris Deugau
Message:

/trunk

Refine type argument handling in getBlockData() and deleteBlock() so
callers can just pass the allocation type instead of monkeying around
building a flag argument. Mainly useful for RPC but will likely trickle
out to internal calls.

File:
1 edited

Legend:

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

    r839 r849  
    29032903
    29042904  # reset $basetype so caller can just pass the complete allocation type
    2905   if ($basetype =~ /.i/) {
     2905  if ($basetype =~ /^.?i$/) {
    29062906    $basetype = 'i';
    29072907  } else {
     
    32223222  my $type = shift || 'b';      # default to netblock for lazy callers
    32233223
     3224  # reset $type so caller can just pass the complete allocation type
     3225  if ($type =~ /^.?i$/) {
     3226    $type = 'i';
     3227  } else {
     3228    $type = 'b';
     3229  }
     3230
    32243231# catch some errors, someday
    32253232#  if (!$id || $id !~ /^\d+$/) {
    32263233#    $errstr = "Allocation ID must be numeric
    32273234#  }
    3228 
    3229   # netblocks are in the allocations table;  pool IPs are in the poolips table.
    3230   # If we try to look up a CIDR in an integer field we should just get back nothing.
    3231   my ($btype) = $dbh->selectrow_array("SELECT type FROM allocations WHERE id=?", undef, ($id) );
    32323235
    32333236  # Note city, vrf, parent_id and master_id removed due to JOIN uncertainty for block allocations
Note: See TracChangeset for help on using the changeset viewer.