Ignore:
Timestamp:
05/02/16 17:59:07 (8 years ago)
Author:
Kris Deugau
Message:

/trunk

main.cgi:

  • Don't spew warnings and break the UI when retrieval of the zone list for a netblock fails

IPDB.pm, ipdb-rpc.cgi:

  • Fill out rpc_listPool stub in ipdb-rpc.cgi. The first likely consumer may not want the full UI dataset (with description and "deleteme" flag) so the core sub has been extended with an optional flag that defaults to on.

ipdb-rpc.cgi:

  • Correct argument validation in rpc_deleteBlock()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/ipdb-rpc.cgi

    r852 r866  
    199199sub rpc_listAllocations {}
    200200sub rpc_listFree {}
    201 sub rpc_listPool {}
     201
     202
     203sub rpc_listPool {
     204  my %args = @_;
     205
     206  _commoncheck(\%args, 'y');
     207
     208  $args{include_desc} = 0 if !$args{include_desc};
     209
     210  # convert passed pool from CIDR to an ID, maybe
     211  if ($args{pool} !~ /^\d+$/) {
     212    die "Invalid pool argument" if $args{pool} !~ m{^\d+\.\d+\.\d+\.\d+/\d+$};
     213    die "VRF is required\n" if !$args{vrf};  # VRF name may not be empty
     214    ($pid) = $ip_dbh->selectrow_array("SELECT a.id FROM allocations a JOIN allocations m ON a.master_id=m.id".
     215        " WHERE a.cidr = ? AND m.vrf = ?", undef, $args{pool}, $args{vrf});
     216  }
     217
     218  return listPool($ip_dbh, $pid, $args{include_desc});
     219} # rpc_listPool()
     220
     221
    202222sub rpc_getMasterList {}
    203223sub rpc_getTypeList {}
     
    291311  _commoncheck(\%args, 'y');
    292312
    293   _validateInput(\%args);
     313  if (!$args{block}) {
     314    $args{block} = $args{cidr} if $args{cidr};
     315    die "Block/IP is required\n" if !$args{block};
     316  }
    294317
    295318  if ($args{block} =~ m{^(?:\d+\.){3}\d+(?:/32)?$}) {
Note: See TracChangeset for help on using the changeset viewer.