Changeset 820 for trunk/cgi-bin/IPDB.pm


Ignore:
Timestamp:
03/11/16 15:14:08 (8 years ago)
Author:
Kris Deugau
Message:

/trunk

Add "delete VRF" confirmation and action pages. Refine link from showvrf
template since a VRF is a completely different type of entity than a
netblock. See #54.

File:
1 edited

Legend:

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

    r818 r820  
    2828        $errstr
    2929        &initIPDBGlobals &connectDB &finish &checkDBSanity
    30         &addVRF &getVRF &addMaster &touchMaster
     30        &addVRF &getVRF &deleteVRF &addMaster &touchMaster
    3131        &listVRF &listSummary &listSubs &listContainers &listAllocations &listForMerge &listFree &listPool
    3232        &getMasterList &getTypeList &getPoolSelect &findAllocateFrom
     
    4444                $errstr
    4545                &initIPDBGlobals &connectDB &finish &checkDBSanity
    46                 &addVRF &getVRF &addMaster &touchMaster
     46                &addVRF &getVRF &deleteVRF &addMaster &touchMaster
    4747                &listVRF &listSummary &listSubs &listContainers &listAllocations &listForMerge &listFree &listPool
    4848                &getMasterList &getTypeList &getPoolSelect &findAllocateFrom
     
    688688  return $dbh->selectrow_hashref("SELECT comment,location FROM vrfs WHERE vrf = ?", {Slice=>{}}, $vrf);
    689689} # end getVRF()
     690
     691
     692## IPDB::deleteVRF()
     693#
     694sub deleteVRF {
     695  my $dbh = shift;
     696  my $vrf = shift;
     697
     698  # Allow transactions, and raise an exception on errors so we can catch it later.
     699  # Use local to make sure these get "reset" properly on exiting this block
     700  local $dbh->{AutoCommit} = 0;
     701  local $dbh->{RaiseError} = 1;
     702
     703  eval {
     704    $dbh->do("DELETE FROM vrfs WHERE vrf = ?", undef, $vrf);
     705    $dbh->commit;
     706  };
     707  if ($@) {
     708    my $msg = $@;       # not much complexity here just yet.
     709    return ('FAIL',$msg);
     710  }
     711
     712  return ('OK','OK');
     713} # end deleteVRF()
    690714
    691715
Note: See TracChangeset for help on using the changeset viewer.