Changeset 851 for trunk


Ignore:
Timestamp:
04/13/16 18:16:46 (8 years ago)
Author:
Kris Deugau
Message:

/trunk

Update syslog and mailNotify() calls to better match the new data
structures, and normalize their formatting

Location:
trunk/cgi-bin
Files:
2 edited

Legend:

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

    r850 r851  
    267267    die "Pool ID or VRF is required\n" if !$args{parent} && !$args{vrf};
    268268    ($args{block}) = $ip_dbh->selectrow_array(
    269        "SELECT id FROM poolips WHERE ip = ? AND ".($args{parent} ? "parent_id = ?" : "vrf = ?"),
    270        undef, $args{block}, ($args{parent} ? $args{parent} : $args{vrf}) );
     269        "SELECT id FROM poolips WHERE ip = ? AND ".($args{parent} ? "parent_id = ?" : "vrf = ?"),
     270        undef, $args{block}, ($args{parent} ? $args{parent} : $args{vrf}) );
    271271  }
    272272
     
    275275  # set assignIP_on_update to simplify some calling situations.  better to use allocateBlock if possible though.
    276276  my ($code,$msg) = updateBlock($ip_dbh, %args, assignIP_on_update => 1);
    277 
    278277  if ($code eq 'FAIL') {
    279     syslog "err", "$args{rpcsystem}/$args{rpcuser} could not update block/IP ID $args{block}: '$msg'";
     278    syslog "err", "$args{rpcsystem}/$args{rpcuser} could not update block/IP $args{block} ($binfo->{block}): '$msg'";
    280279    die "$msg\n";
    281280  }
    282 
    283   syslog "notice", "$authuser updated $args{block}";
     281  syslog "notice", "$args{rpcsystem}/$args{rpcuser} updated $args{block} ($binfo->{block})";
    284282
    285283  return $msg;
    286 
    287284} # rpc_updateBlock()
    288285
  • trunk/cgi-bin/main.cgi

    r839 r851  
    13171317
    13181318  if ($code eq 'FAIL') {
    1319     syslog "err", "$authuser could not update block/IP '$binfo->{block}' (id $webvar{block}): '$msg'";
     1319    syslog "err", "$authuser could not update block/IP $webvar{block} ($binfo->{block}): '$msg'";
    13201320    $page->param(err => "Could not update block/IP $binfo->{block}: $msg");
    13211321    return;
     
    13231323
    13241324  # If we get here, the operation succeeded.
    1325   syslog "notice", "$authuser updated $binfo->{block}";
     1325  syslog "notice", "$authuser updated $webvar{block} ($binfo->{block})";
    13261326##fixme:  log details of the change?  old way is in the .debug stream anyway.
    13271327##fixme:  need to wedge something in to allow "update:field" notifications
     
    17251725  }
    17261726  if ($code eq 'OK' || $code =~ /^WARN/) {
    1727     syslog "notice", "$authuser deallocated '".$blockinfo->{type}."'-type netblock $webvar{block} ".
    1728         $blockinfo->{custid}.", ".$blockinfo->{city}.", desc='".$blockinfo->{description}."'";
    1729     mailNotify($ip_dbh, 'da', "REMOVED: ".$disp_alloctypes{$blockinfo->{type}}." $webvar{block}",
    1730         $disp_alloctypes{$blockinfo->{type}}." $webvar{block} deallocated by $authuser\n".
    1731         "CustID: ".$blockinfo->{custid}."\nCity: ".$blockinfo->{city}.
    1732         "\nDescription: ".$blockinfo->{description}."\n");
     1727    syslog "notice", "$authuser deallocated '".$blockinfo->{type}."'-type netblock ID $webvar{block} ".
     1728        "($blockinfo->{block}), $blockinfo->{custid}, $blockinfo->{city}, desc='$blockinfo->{description}'";
     1729    mailNotify($ip_dbh, 'da', "REMOVED: $disp_alloctypes{$blockinfo->{type}} $blockinfo->{block}",
     1730# $webvar{block} useful?  do we care about the block ID here?
     1731        "$disp_alloctypes{$blockinfo->{type}} $blockinfo->{block} deallocated by $authuser\n".
     1732        "CustID: $blockinfo->{custid}\nCity: $blockinfo->{city}\n".
     1733        "Description: $blockinfo->{description}\n");
    17331734  } else {
    17341735    $page->param(failmsg => $msg);
    17351736    if ($webvar{alloctype} =~ /^.i$/) {
    1736       syslog "err", "$authuser could not deallocate static IP '$webvar{block}': '$msg'";
     1737      syslog "err", "$authuser could not deallocate static IP $webvar{block} ($blockinfo->{block}): '$msg'";
    17371738    } else {
    1738       syslog "err", "$authuser could not deallocate netblock '$webvar{block}': '$msg'";
     1739      syslog "err", "$authuser could not deallocate netblock $webvar{block} ($blockinfo->{block}): '$msg'";
    17391740      $page->param(netblock => 1);
    17401741    }
Note: See TracChangeset for help on using the changeset viewer.