Commit cacc42dd authored by Robert Ricci's avatar Robert Ricci

Use libtblog for snmpitWarn and snmpitFatal so that we can directly

tag snmpit error messages as being hardware errors.

Don't export the snmpitFatal and snmpitWarn functions - these are
really supposed to be internal, and I've tweaked their meaning a
bit. Nothing else calls them.
parent c408b6e5
......@@ -21,15 +21,16 @@ use Exporter;
getSwitchStacks
getStackType getStackLeader
getDeviceOptions getTrunks getTrunksFromSwitches
getTrunkHash
getTrunkHash
getExperimentPorts snmpitGet snmpitGetWarn snmpitGetFatal
snmpitSet snmpitSetWarn snmpitSetFatal snmpitWarn snmpitFatal
snmpitSet snmpitSetWarn snmpitSetFatal
snmpitBulkwalk snmpitBulkwalkWarn snmpitBulkwalkFatal
printVars tbsort );
use English;
use libdb;
use libtestbed;
use libtblog ('tbdie', 'tbwarn');
use strict;
use SNMP;
......@@ -989,11 +990,11 @@ sub printVars($) {
# Both print out an error message and mail it to the testbed ops. Prints out
# the snmpitErrorString set by snmpitGet.
#
# usage: snmpitWarn(message)
# usage: snmpitWarn(message,fatal)
#
sub snmpitWarn($) {
sub snmpitWarn($$) {
my ($message) = @_;
my ($message,$fatal) = @_;
#
# Untaint $PRORAM_NAME
......@@ -1008,9 +1009,12 @@ sub snmpitWarn($) {
my $text = "$message - In $progname\n" .
"$snmpitErrorString\n";
print STDERR "*** $text";
if ($fatal) {
tbdie({cause => 'hardware'}, $text);
} else {
tbwarn({cause => 'hardware'}, $text);
}
libtestbed::SENDMAIL($TBOPS, "snmpitError - $message", $text);
}
#
......@@ -1018,8 +1022,7 @@ sub snmpitWarn($) {
#
sub snmpitFatal($) {
my ($message) = @_;
snmpitWarn($message);
die("\n");
snmpitWarn($message,1);
}
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment