Changeset 745


Ignore:
Timestamp:
06/16/15 17:47:30 (9 years ago)
Author:
Kris Deugau
Message:

/trunk

Add a flag to _toPool() to indicate whether to return all of the
allocations converted. Defaults to "off", but required so that rDNS
deletes can be called with the complete list of leaf blocks converted.
Also return type code of merged/returned blocks for further internal
processing.
See #8.

File:
1 edited

Legend:

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

    r744 r745  
    229229  my $convblock = shift;  # May be smaller than the block referenced by $poolparent
    230230  my $pooltype = shift;
     231  my $retall = shift || 0;
    231232
    232233  # there is probably a way to avoid the temporary $foo here
     
    283284        $poolcounter{"$newip"}++;
    284285      }
    285     } elsif ($oldalloc[2] =~ /.[dp]/) {
     286    } elsif ($oldtype =~ /.[dp]/) {
    286287      # Reparent IPs in an existing pool, and rewrite their type
    287288      $updsth->execute($poolparent, $poolclass.'i', $oldid);
     
    294295    $delsth->execute($oldid) unless $oldid == $poolparent;
    295296    # Return the converted blocks, but only the immediate peers, not the entire tree
    296     push @retlist, { block => $oldcidr, mtype => $disp_alloctypes{$oldtype} }
    297         if $oldparent == $mainparent;
    298   }
     297    push @retlist, { block => $oldcidr, mdisp => $disp_alloctypes{$oldtype}, mtype => $oldtype }
     298        if (($oldparent == $mainparent) || $retall) && $oldid != $poolparent;
     299  } # while $asth->fetch
     300
    299301  return \@retlist;
    300302} # end _toPool()
Note: See TracChangeset for help on using the changeset viewer.