Commit 86b15235 authored by Kevin Atkinson's avatar Kevin Atkinson

Changed tbdie to die if before "require libtblog".

Fixed a few calls to tbwarn/tberror/tbdie to get better results.

Include Cause & Confidence rating in the error string stored in the
database for future reference.
parent 6931aba0
......@@ -199,6 +199,10 @@ sub fatal (@)
# We want warnings to cause assign_wrapper to exit abnormally.
# We will come through here no matter how we exit though.
#
# FIXME: Is this still needed. "warn" is only used once. Also this
# will cause perl internal warnings (such as "Use of uninitialized
# value ..." to cause assign_wrapper to fail. -- kevina
#
$SIG{__WARN__} = sub { tbwarn $_[0];$warnings++; };
END {
......@@ -4452,9 +4456,9 @@ sub CreateTopFile()
#
if (! (defined(virtnodeosid($node0)) &&
defined(virtnodeosid($node1)))) {
tbwarn("You must specify the OSID for all nodes in ".
"lan $lan, when using linkdelays ".
"(endnode traffic shaping)\n");
tberror("You must specify the OSID for all nodes in ".
"lan $lan, when using linkdelays ".
"(endnode traffic shaping)\n");
$toperrors++;
}
else {
......@@ -4465,9 +4469,9 @@ sub CreateTopFile()
my $osid = virtnodeosid($node);
if (! $osdoeslinkdelays{$osid}) {
tbwarn("$node in link $lan is running an OSID ".
"($osid) that does not support linkdelays ".
"(endnode traffic shaping)\n");
tberror("$node in link $lan is running an OSID ".
"($osid) that does not support linkdelays ".
"(endnode traffic shaping)\n");
$toperrors++;
}
}
......
......@@ -617,12 +617,12 @@ sub tblog_find_error ( ;$$ ) {
$error = "No clue as to what went wrong!\n" unless length $error > 0;
if ($store) {
$error .= "Cause: $cause\n";
$error .= "Confidence: $confidence\n";
print SERR "**** Experimental information, please ignore ****\n";
print SERR "Session ID = $ENV{TBLOG_SESSION}\n";
print SERR "Likely Cause of the Problem:\n";
print SERR $error;
print SERR "Cause: $cause\n";
print SERR "Confidence: $confidence\n";
print SERR "**** End experimental information ****\n";
chop $error;
dblog $NOTICE, {type=>'thecause'}, $error;
......
......@@ -68,13 +68,13 @@ if ($TESTMODE) {
}
elsif ($EUID != 0) {
# We don't want to run this script unless its the real version.
tbdie("Must be root! Maybe its a development version?");
die("Must be root! Maybe its a development version?");
}
# This script is setuid, so please do not run it as root. Hard to track
# what has happened.
if ($UID == 0) {
tbdie("Please do not run this as root! Its already setuid!");
die("Please do not run this as root! Its already setuid!");
}
#
......
......@@ -43,13 +43,13 @@ delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
if ($EUID != 0) {
# We don't want to run this script unless its the real version.
tbdie("Must be root! Maybe its a development version?");
die("Must be root! Maybe its a development version?");
}
# This script is setuid, so please do not run it as root. Hard to track
# what has happened.
if ($UID == 0) {
tbdie("Please do not run this as root! Its already setuid!");
die("Please do not run this as root! Its already setuid!");
}
#
......@@ -140,8 +140,7 @@ while (!$done) {
$done = 1;
}
elsif (!$nsline || !$dbline) {
tbdie({type=>'extra'},
"Topology verification failed (short file)!");
tbdie("Topology verification failed (short file)!");
}
elsif ($nsline =~ /^l \S+ \S+ \d+ \d+\.\d+ \d+\.\d+ \S+ \S+$/ &&
$dbline =~ /^l \S+ \S+ \d+ \d+\.\d+ \d+\.\d+ \S+ \S+$/) {
......@@ -163,14 +162,12 @@ while (!$done) {
print "'$nsmatches[$lpc]' != '$dbmatches[$lpc]' in\n";
print "ns: $nsline";
print "db: $dbline";
tbdie({type=>'extra'},
"Topology verification failed!");
tbdie("Topology verification failed!");
}
}
}
elsif ($nsline ne $dbline) {
tbdie({type=>'extra'},
"Topology verification failed ('$nsline'!='$dbline')!");
tbdie("Topology verification failed ('$nsline'!='$dbline')!");
}
}
......
......@@ -1459,7 +1459,7 @@ sub CheckFWinfo($)
return 0;
noway:
tberror($msg);
tberror({sublevel=>1}, $msg);
return 1;
}
......
......@@ -63,13 +63,13 @@ if ($TESTMODE) {
}
elsif ($EUID != 0) {
# We don't want to run this script unless its the real version.
tbdie("Must be root! Maybe its a development version?");
die("Must be root! Maybe its a development version?");
}
# This script is setuid, so please do not run it as root. Hard to track
# what has happened.
if ($UID == 0) {
tbdie("Please do not run this as root! Its already setuid!");
die("Please do not run this as root! Its already setuid!");
}
#
......
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