Changeset 754
- Timestamp:
- 07/03/15 16:35:36 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/IPDB.pm
r753 r754 1444 1444 return ('FAIL', $msg); 1445 1445 } else { 1446 _rpc('addOrUpdateRevRec', cidr => "$args{cidr}", name => $args{rdns}, rpcuser => $args{user}); 1446 # Snag the pool info 1447 my $pinfo = getBlockData($args{parent}); 1448 # Only try to update rDNS when the pool is flagged as "rDNS available" 1449 if ($binfo->{revavail} || $binfo->{revpartial}) { 1450 _rpc('addOrUpdateRevRec', cidr => "$args{cidr}", name => $args{rdns}, rpcuser => $args{user}); 1451 } 1447 1452 return ('OK', $args{cidr}); 1448 1453 } … … 1584 1589 } # end fullcidr != alloc_from 1585 1590 1586 # now we do the DNS dance for netblocks, if we have an RPC server to do it with and a pattern to use. 1587 _rpc('addOrUpdateRevRec', cidr => "$args{cidr}", name => $args{rdns}, rpcuser => $args{user}) 1588 if $args{rdns}; 1589 1590 # and the per-IP set, if there is one. 1591 _rpc('updateRevSet', %{$args{iprev}}, rpcuser => $args{user}); 1591 # Snag the parent info 1592 my $pinfo = getBlockData($fbparent); 1593 # Only try to update rDNS when the pool is flagged as "rDNS available" 1594 if ($binfo->{revavail} || $binfo->{revpartial}) { 1595 # now we do the DNS dance for netblocks, if we have an RPC server to do it with and a pattern to use. 1596 _rpc('addOrUpdateRevRec', cidr => "$args{cidr}", name => $args{rdns}, rpcuser => $args{user}) 1597 if $args{rdns}; 1598 1599 # and the per-IP set, if there is one. 1600 _rpc('updateRevSet', %{$args{iprev}}, rpcuser => $args{user}); 1601 } 1592 1602 1593 1603 return ('OK', 'OK'); … … 1791 1801 return ('FAIL', $msg); 1792 1802 } 1803 1804 # Do RPC rDNS call, if available. 1805 # Snag the parent info 1806 my $pinfo = getBlockData($args{parent}); 1807 # Return early if rDNS flag(s) are not set 1808 return ('OK','OK') unless ($pinfo->{revavail} || $pinfo->{revpartial}); 1793 1809 1794 1810 # In case of any container (mainly master block), only update freeblocks so we don't stomp subs … … 1984 2000 return; 1985 2001 } 1986 ##fixme: RPC return code? 1987 # particularly useful in this case as there may be arbitrary combinations of pass, warn, fail 1988 # results from each of the update and add(s), which could get the user to prod dnsadmin to see what exploded 1989 my $foo = _rpc('splitTemplate', cidr => $binfo->{block}, newmask => $args{newmask}, rpcuser => $args{user});2002 2003 # Only try to update rDNS when the original block is flagged as "rDNS available" 2004 _rpc('splitTemplate', cidr => $binfo->{block}, newmask => $args{newmask}, rpcuser => $args{user}); 2005 if ($binfo->{revavail} || $binfo->{revpartial}); 1990 2006 1991 2007 return \@ret; … … 2114 2130 return; 2115 2131 } 2132 2133 # Only try to update rDNS when the original block is flagged as "rDNS available" 2134 _rpc('resizeTemplate', oldcidr => $binfo->{block}, newcidr => $newblock->network, rpcuser => $args{user}); 2135 if ($binfo->{revavail} || $binfo->{revpartial}); 2116 2136 2117 2137 return \@ret; … … 2635 2655 # Note that we still need some additional code in the odd case 2636 2656 # of a netblock-aligned contiguous group of static IPs 2657 my $pinfo; 2637 2658 2638 2659 eval { 2639 2660 $msg = "Unable to deallocate $disp_alloctypes{$binfo->{type}} $cidr"; 2640 my$pinfo = getBlockData($dbh, $binfo->{parent_id}, 'b');2661 $pinfo = getBlockData($dbh, $binfo->{parent_id}, 'b'); 2641 2662 ##fixme: VRF and rdepth 2642 2663 $dbh->do("UPDATE poolips SET custid = ?, available = 'y',". … … 2650 2671 eval { $dbh->rollback; }; 2651 2672 return ('FAIL',$msg); 2652 } else { 2673 } 2674 2653 2675 ##fixme: RPC return code? 2654 _rpc('delByCIDR', cidr => "$cidr", user => $user, delforward => $delfwd, rpcuser => $user); 2655 return ('OK',"OK"); 2656 } 2676 _rpc('delByCIDR', cidr => "$cidr", user => $user, delforward => $delfwd, rpcuser => $user) 2677 if ($pinfo->{revavail} || $pinfo->{revpartial}); 2678 2679 return ('OK',"OK"); 2657 2680 2658 2681 } elsif ($binfo->{type} eq 'mm') { # end alloctype =~ /.i/ … … 2685 2708 my @fails; 2686 2709 foreach my $subzone (@zonelist) { 2710 # We don't wrap this call tighter, since there isn't an inherent allocation to check for rDNS-ability. 2687 2711 if ($rpc_url && !_rpc('delZone', zone => "$subzone", revrec => 'y', rpcuser => $user, delforward => $delfwd) ) { 2688 2712 push @fails, ("$subzone" => $errstr); … … 2878 2902 eval { $dbh->rollback; }; 2879 2903 return ('FAIL', $msg); 2880 } else { 2904 } 2905 2881 2906 ##fixme: RPC return code? 2882 _rpc('delByCIDR', cidr => "$cidr", rpcuser => $user, delforward => $delfwd, delsubs => 'y', parpatt => $ppatt); 2883 return ($retcode, $goback); 2884 } 2907 _rpc('delByCIDR', cidr => "$cidr", rpcuser => $user, delforward => $delfwd, delsubs => 'y', parpatt => $ppatt) 2908 if ($binfo->{revavail} || $binfo->{revpartial}); 2909 2910 return ($retcode, $goback); 2885 2911 2886 2912 } # end alloctype != netblock … … 2981 3007 2982 3008 my $remote_rdns = _rpc('getRevPattern', %rpcargs); 2983 $rdns = $remote_rdns if $remote_rdns; 2984 $cached = 0; 3009 if ($remote_rdns) { 3010 $rdns = $remote_rdns; 3011 $cached = 0; 3012 } 2985 3013 } 2986 3014
Note:
See TracChangeset
for help on using the changeset viewer.