Changeset 850
- Timestamp:
- 04/13/16 18:13:05 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/ipdb-rpc.cgi
r838 r850 288 288 289 289 290 sub rpc_deleteBlock {} 290 sub rpc_deleteBlock { 291 my %args = @_; 292 293 _commoncheck(\%args, 'y'); 294 295 _validateInput(\%args); 296 297 if ($args{block} =~ m{^(?:\d+\.){3}\d+(?:/32)?$}) { 298 # deleting a static IP. retrieve the IP ID based on either the parent or VRF. 299 die "Pool ID or VRF is required\n" if !$args{parent} && !$args{vrf}; 300 ($args{block}) = $ip_dbh->selectrow_array( 301 "SELECT id FROM poolips WHERE ip = ? AND ".($args{parent} ? "parent_id = ?" : "vrf = ?"), 302 undef, $args{block}, ($args{parent} ? $args{parent} : $args{vrf}) ); 303 warn "passed block $args{block} guessed as $args{block}\n"; 304 } 305 306 # snag block info for log 307 my $blockinfo = getBlockData($ip_dbh, $args{block}, $args{type}); 308 my ($code,$msg) = deleteBlock($ip_dbh, $args{block}, $args{type}, $args{delfwd}, $args{rpcuser}); 309 310 my $authuser = "$args{rpcsystem}/$args{rpcuser}"; 311 if ($code eq 'OK' || $code =~ /^WARN/) { 312 syslog "notice", "$authuser deallocated '$blockinfo->{type}'-type netblock ID $args{block} ". 313 "($blockinfo->{block}), $blockinfo->{custid}, $blockinfo->{city}, desc='$blockinfo->{description}'"; 314 mailNotify($ip_dbh, 'da', "REMOVED: $disp_alloctypes{$blockinfo->{type}} $blockinfo->{block}", 315 # $args{block} useful? do we care about the block ID here? 316 "$disp_alloctypes{$blockinfo->{type}} $blockinfo->{block} deallocated by $authuser\n". 317 "CustID: $blockinfo->{custid}\nCity: $blockinfo->{city}\n". 318 "Description: $blockinfo->{description}\n"); 319 } else { 320 if ($args{type} =~ /^.i$/) { 321 syslog "err", "$authuser could not deallocate static IP ID $args{block} ($blockinfo->{block}): '$msg'"; 322 } else { 323 syslog "err", "$authuser could not deallocate netblock ID $args{block} ($blockinfo->{block}): '$msg'"; 324 } 325 } 326 327 return $msg; 328 } # rpc_deleteBlock() 329 330 291 331 sub rpc_getBlockData {} 292 332 sub rpc_getBlockRDNS {}
Note:
See TracChangeset
for help on using the changeset viewer.