All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit adefb79a authored by Leigh B. Stoller's avatar Leigh B. Stoller

A set of rather tedious and trivial changes to localize the subject

line in all email from the system. Remove all of the TESTBED: tags
and modify the email function in the web server and perl library to
prepend @DOMAIN@: to the message.
parent 5db6c935
......@@ -1149,7 +1149,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/webnodecontrol tbsetup/node_control \
tbsetup/webmkgroup tbsetup/mkgroup \
tbsetup/webmkacct tbsetup/mkacct \
tbsetup/webmkproj tbsetup/mkproj \
tbsetup/webmkproj tbsetup/mkproj tbsetup/libtestbed.pm \
tip/GNUmakefile \
tmcd/GNUmakefile tmcd/freebsd/GNUmakefile tmcd/linux/GNUmakefile \
tmcd/netbsd/GNUmakefile \
......
......@@ -234,7 +234,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/webnodecontrol tbsetup/node_control \
tbsetup/webmkgroup tbsetup/mkgroup \
tbsetup/webmkacct tbsetup/mkacct \
tbsetup/webmkproj tbsetup/mkproj \
tbsetup/webmkproj tbsetup/mkproj tbsetup/libtestbed.pm \
tip/GNUmakefile \
tmcd/GNUmakefile tmcd/freebsd/GNUmakefile tmcd/linux/GNUmakefile \
tmcd/netbsd/GNUmakefile \
......
......@@ -131,7 +131,7 @@ if (-e "$basename" && system("gzip -9 $basename")) {
fatal("gzip $basename failed!");
}
#system("cat $logname | /usr/bin/mail -s '\"DB Backup Finished\"' stoller");
#SENDMAIL("stoller", "DB Backup Finished", "", undef, undef, ($logname));
unlink("$logname");
exit 0;
......@@ -139,9 +139,8 @@ sub fatal($) {
my ($msg) = @_;
print STDERR "$msg\n";
system("cat $logname | /usr/bin/mail ".
"-s '\"DB Backup Failed\"' \"$TBOPS\"");
SENDMAIL($TBOPS, "DB Backup Failed", $msg, undef, undef, ($logname));
unlink("$logname");
exit(1);
}
......@@ -67,7 +67,7 @@ DBQueryFatal("update images set load_address=''");
#
DBQueryFatal("delete from login");
system("cat $logname | /usr/bin/mail -s '\"DB Boot Finished\"' stoller");
#SENDMAIL("stoller", "DB Boot Finished", "", undef, undef, ($logname));
unlink("$logname");
exit 0;
......@@ -75,9 +75,7 @@ sub fatal($) {
my ($msg) = @_;
print STDERR "$msg\n";
system("cat $logname | /usr/bin/mail ".
"-s '\"DB Boot Failed\"' \"$TBOPS\"");
SENDMAIL($TBOPS, "DB Boot Failed", $msg, undef, undef, ($logname));
unlink("$logname");
exit(1);
}
......@@ -140,6 +140,6 @@ exit 0;
sub fatal {
local($msg) = $_[0];
SENDMAIL($TBOPS, "TESTBED: Failure Generating Email Lists", $msg);
SENDMAIL($TBOPS, "Failure Generating Email Lists", $msg);
die($msg);
}
......@@ -42,6 +42,10 @@ delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
#
$| = 1;
# Load the Testbed support stuff.
use lib "@prefix@/lib";
use libtestbed;
if (@ARGV != 1 || ($ARGV[0] ne "-all" && $ARGV[0] ne "-active")) {
usage();
}
......@@ -74,8 +78,7 @@ exit(0);
sub fatal {
local($msg) = $_[0];
system("echo \"$msg\" | /usr/bin/mail ".
"-s 'TESTBED: Named Setup Failed' $TBOPS");
SENDMAIL($TBOPS, "genelists.proxy failure", $msg);
die($msg);
}
......@@ -1375,10 +1375,9 @@ sub DBWarn($)
$text = "$message - In $progname\n" .
"$DBErrorString\n";
print STDERR "*** $text\n";
print STDERR "*** $text";
system("echo \"$text\" | /usr/bin/mail ".
"-s 'TESTBED: DBError - $message' \"$TBOPS\"");
libtestbed::SENDMAIL($TBOPS, "DBError - $message", $text);
}
#
......
......@@ -83,7 +83,7 @@ while (1) {
print "Exited with status $exit_status at " . TBTimeStamp() . "\n";
SENDMAIL($TBOPS, "TESTBED: Genlastlog Failed!",
SENDMAIL($TBOPS, "Genlastlog Failed!",
"Failed with exit value $exit_status.\n".
"Please look at the syslog entries for genlastlog!");
}
......
......@@ -99,7 +99,8 @@ post-install:
# Control node installation (okay, plastic)
#
control-install: $(addprefix $(INSTALL_SBINDIR)/, console_setup.proxy) \
$(addprefix $(INSTALL_SBINDIR)/, exports_setup.proxy)
$(addprefix $(INSTALL_SBINDIR)/, exports_setup.proxy) \
$(addprefix $(INSTALL_LIBDIR)/, libtestbed.pm)
cd $(INSTALL_BINDIR) && \
list='$(USERBINS)'; for file in $$list; do \
rm -f $$file; \
......
......@@ -594,7 +594,7 @@ sub donotify($$$)
print STDOUT "$mesg";
$subject = "TESTBED: Batch Mode Experiment $subtext $pid/$eid";
$subject = "Batch Mode Experiment $subtext $pid/$eid";
$from = $TBOPS;
$hdrs = "Reply-To: $TBOPS";
......
......@@ -317,7 +317,7 @@ my $message =
"in your message to $TBOPS\n";
SENDMAIL("$user_name <$user_email>",
"TESTBED: Experiment $pid/$eid Terminated",
"Experiment $pid/$eid Terminated",
$message,
"$user_name <$user_email>",
"Cc: $expt_head_name <$expt_head_email>\n".
......@@ -352,7 +352,7 @@ sub fatal($)
# Send a message to the testbed list. Append the logfile.
#
SENDMAIL("$user_name <$user_email>",
"TESTBED: Termination Failure: $pid/$eid",
"Termination Failure: $pid/$eid",
$mesg,
"$user_name <$user_email>",
"Cc: $expt_head_name <$expt_head_email>\n".
......
......@@ -226,7 +226,7 @@ exit(0);
sub fatal {
local($msg) = $_[0];
SENDMAIL($TBOPS, "TESTBED: Exports Setup Failed", $msg);
SENDMAIL($TBOPS, "Exports Setup Failed", $msg);
die($msg);
}
......
......@@ -37,6 +37,12 @@ delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
$| = 1; #Turn off line buffering on output
#
# Testbed Support libraries
#
use lib "@prefix@/lib";
use libtestbed;
#
# Take our input and write it to the tail file.
#
......@@ -110,8 +116,7 @@ exit(0);
sub fatal {
local($msg) = $_[0];
system("echo \"$msg\" | /usr/bin/mail ".
"-s 'TESTBED: Named Setup Failed' $TBOPS");
SENDMAIL($TBOPS, "Exports Setup Failed", $msg);
die($msg);
}
......@@ -37,6 +37,12 @@ delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
$| = 1; #Turn off line buffering on output
#
# Testbed Support libraries
#
use lib "@prefix@/lib";
use libtestbed;
#
# Take our input and write it to the tail file.
#
......@@ -110,8 +116,7 @@ exit(0);
sub fatal {
local($msg) = $_[0];
system("echo \"$msg\" | /usr/bin/mail ".
"-s 'TESTBED: Named Setup Failed' $TBOPS");
SENDMAIL($TBOPS, "Exports Setup Failed", $msg);
die($msg);
}
......@@ -115,7 +115,7 @@ while (1) {
waitpid($child_pid, 0);
if ($?) {
SENDMAIL($TBOPS, "TESTBED: Frisbeed Failed!",
SENDMAIL($TBOPS, "Frisbeed Failed!",
"Imageid: $imageid\n".
"Address: $address\n\n".
"Process $child_pid exited with value $?.\n".
......
......@@ -10,6 +10,8 @@ use Exporter;
qw ( SENDMAIL OPENMAIL TBTimeStamp TBBackGround TBDateTimeFSSafe
TBMakeLogname );
my $MAILTAG = "@OURDOMAIN@";
# A library of useful stuff.
# Send an email message via sendmail -t.
......@@ -23,6 +25,7 @@ use Exporter;
sub SENDMAIL($$$;$$@)
{
my($To, $Subject, $Message, $From, $Headers, @Files) = @_;
my $tag = uc($MAILTAG);
if (! open(MAIL, "|/usr/sbin/sendmail -t")) {
print STDERR "SENDMAIL: Could not start sendmail: $!\n";
......@@ -36,7 +39,7 @@ sub SENDMAIL($$$;$$@)
print MAIL "From: $From\n";
}
print MAIL "To: $To\n";
print MAIL "Subject: $Subject\n";
print MAIL "Subject: $tag: $Subject\n";
if (defined($Headers)) {
print MAIL "$Headers\n";
}
......@@ -88,7 +91,7 @@ sub OPENMAIL($$;$$)
print MAIL "From: $From\n";
}
print MAIL "To: $To\n";
print MAIL "Subject: $Subject\n";
print MAIL "Subject: $tag: $Subject\n";
if (defined($Headers)) {
print MAIL "$Headers\n";
}
......
......@@ -281,6 +281,6 @@ exit(0);
sub fatal {
local($msg) = $_[0];
SENDMAIL($TBOPS, "TESTBED: mkacct-ctrl Failed", $msg);
SENDMAIL($TBOPS, "mkacct Failed", $msg);
die("$0: $msg\n");
}
......@@ -326,7 +326,7 @@ sub donotify($$)
}
SENDMAIL($to,
"TESTBED: Group Creation " . $subtext . ": $pid/$gid",
"Group Creation " . $subtext . ": $pid/$gid",
$mesg, $from, $hdrs,
($logname));
}
......
......@@ -195,6 +195,6 @@ exit(0);
sub fatal {
local($msg) = $_[0];
SENDMAIL($TBOPS, "TESTBED: mkproj $pid Failed", $msg);
SENDMAIL($TBOPS, "mkproj $pid Failed", $msg);
die("$0: $msg\n");
}
......@@ -159,6 +159,6 @@ exit(0);
sub fatal {
local($msg) = $_[0];
SENDMAIL($TBOPS, "TESTBED: Named Setup Failed", $msg);
SENDMAIL($TBOPS, "Named Setup Failed", $msg);
die($msg);
}
......@@ -279,10 +279,10 @@ sub NotifyUser($$)
}
if ($iserr) {
$subject = "TESTBED: Node Update Failed $pid/$eid";
$subject = "Node Update Failed $pid/$eid";
}
else {
$subject = "TESTBED: Node Update Success $pid/$eid";
$subject = "Node Update Success $pid/$eid";
}
$from = $TBOPS;
$hdrs = "Reply-To: $TBOPS";
......
......@@ -410,7 +410,7 @@ foreach my $node ( @nodes ) {
# Send mail to testbed-ops and to the user about it.
my ($user) = getpwuid($UID);
SENDMAIL($user, "TESTBED: Node $node is down",
SENDMAIL($user, "Node $node is down",
"Node $node in pid/eid $pid/$eid appears to be dead.\n\n".
"Your experiment will continue to run since this failure\n".
"is nonfatal, although you might encounter other problems\n".
......@@ -431,7 +431,7 @@ foreach my $node ( @nodes ) {
MarkNodeDown($node);
# Send mail to testbed-ops about it
SENDMAIL($TBOPS, "TESTBED: Node $node is down",
SENDMAIL($TBOPS, "Node $node is down",
"Node $node in pid/eid $pid/$eid appears to be dead.\n\n".
"Please look into this matter. $node has been reserved\n".
"by the Testbed until this matter has been resolved.\n\n".
......
......@@ -358,7 +358,7 @@ sub fatal($)
{
local($msg) = $_[0];
SENDMAIL($TBOPS, "TESTBED: Reload Daemon Died", $msg);
SENDMAIL($TBOPS, "Reload Daemon Died", $msg);
die($msg);
}
......@@ -367,7 +367,7 @@ sub notify($)
my($mesg) = $_[0];
print "$mesg\n";
SENDMAIL($TBOPS, "TESTBED: Reload Daemon Message", $mesg);
SENDMAIL($TBOPS, "Reload Daemon Message", $mesg);
}
#
......
......@@ -115,6 +115,6 @@ exit(0);
sub fatal {
local($msg) = $_[0];
SENDMAIL($TBOPS, "TESTBED: rmacct-ctrl Failed", $msg);
SENDMAIL($TBOPS, "rmacct-ctrl Failed", $msg);
die("$0: $msg");
}
......@@ -368,7 +368,7 @@ sub donotify($$)
}
SENDMAIL($to,
"TESTBED: Group Update $subtext",
"Group Update $subtext",
$mesg, $from, $hdrs,
($logname));
}
......@@ -314,7 +314,7 @@ my $message =
SENDMAIL("$user_name <$user_email>",
"TESTBED: New Experiment Created: $pid/$eid",
"New Experiment Created: $pid/$eid",
$message,
"$user_name <$user_email>",
"Bcc: $TBLOGS",
......@@ -349,7 +349,7 @@ sub fatal()
# Send a message to the testbed list.
#
SENDMAIL("$user_name <$user_email>",
"TESTBED: Experiment Configure Failure: $pid/$eid",
"Experiment Configure Failure: $pid/$eid",
$mesg,
"$user_name <$user_email>",
"Cc: $TBOPS",
......
......@@ -310,7 +310,7 @@ my $message =
"in your message to $TBOPS\n";
SENDMAIL("$user_name <$user_email>",
"TESTBED: Experiment $pid/$eid Swapped $inout",
"Experiment $pid/$eid Swapped $inout",
$message,
"$user_name <$user_email>",
"Cc: $expt_head_name <$expt_head_email>\n".
......@@ -345,7 +345,7 @@ sub fatal($)
# Send a message to the testbed list. Append the logfile.
#
SENDMAIL("$user_name <$user_email>",
"TESTBED: Swap${inout} Failure: $pid/$eid",
"Swap${inout} Failure: $pid/$eid",
$mesg,
"$user_name <$user_email>",
"Cc: $expt_head_name <$expt_head_email>\n".
......
......@@ -324,7 +324,7 @@ if ($result) {
}
SENDMAIL("$user_name <$user_email>",
"TESTBED: Image Creation on $node Completed: $pid/$imagename",
"Image Creation on $node Completed: $pid/$imagename",
"Image creation on $node has completed. As you requested, the\n".
"image has been written to $filename.\n".
"You may now os_load this image on other nodes in your experiment.\n",
......@@ -353,7 +353,7 @@ sub fatal($)
# Send a message to the testbed list.
#
SENDMAIL("$user_name <$user_email>",
"TESTBED: Image Creation Failure on $node: $pid/$imagename",
"Image Creation Failure on $node: $pid/$imagename",
$mesg,
"$user_name <$user_email>",
"Cc: $TBOPS",
......
......@@ -82,8 +82,8 @@ if (strcmp($approval, "postpone") == 0) {
</h3>\n";
}
elseif (strcmp($approval, "moreinfo") == 0) {
mail("$headname '$headuid' <$headuid_email>",
"TESTBED: Project '$pid' Approval Postponed",
TBMAIL("$headname '$headuid' <$headuid_email>",
"Project '$pid' Approval Postponed",
"\n".
"This message is to notify you that your project application\n".
"for $pid has been postponed until we have more information.\n".
......@@ -115,8 +115,8 @@ elseif ((strcmp($approval, "deny") == 0) ||
DBQueryFatal("delete from groups where pid='$pid' and gid='$pid'");
DBQueryFatal("delete from projects where pid='$pid'");
mail("$headname '$headuid' <$headuid_email>",
"TESTBED: Project '$pid' Denied",
TBMAIL("$headname '$headuid' <$headuid_email>",
"Project '$pid' Denied",
"\n".
"This message is to notify you that your project application\n".
"for $pid has been denied.\n".
......@@ -136,8 +136,8 @@ elseif ((strcmp($approval, "deny") == 0) ||
if (strcmp($approval, "destroy") == 0) {
DBQueryFatal("delete from users where uid='$headuid'");
mail("$headname '$headuid' <$headuid_email>",
"TESTBED: Account '$headuid' Terminated",
TBMAIL("$headname '$headuid' <$headuid_email>",
"Account '$headuid' Terminated",
"\n".
"This message is to notify you that your account has been \n".
"terminated because your project $pid was denied.\n".
......@@ -185,8 +185,8 @@ elseif (strcmp($approval, "approve") == 0) {
"WHERE uid='$headuid'");
}
mail("$headname '$headuid' <$headuid_email>",
"TESTBED: Project '$pid' Approval",
TBMAIL("$headname '$headuid' <$headuid_email>",
"Project '$pid' Approval",
"\n".
"This message is to notify you that your project $pid\n".
"has been approved.\n".
......
......@@ -360,8 +360,8 @@ while (list ($header, $value) = each ($HTTP_POST_VARS)) {
"where uid='$user' and pid='$project' and ".
" gid='$group'");
mail("$user_name '$user' <$user_email>",
"TESTBED: Membership Denied in '$project/$group'",
TBMAIL("$user_name '$user' <$user_email>",
"Membership Denied in '$project/$group'",
"\n".
"This message is to notify you that you have been denied\n".
"membership in project/group $project/$group.\n".
......@@ -470,8 +470,8 @@ while (list ($header, $value) = each ($HTTP_POST_VARS)) {
"WHERE uid='$user'");
}
mail("$user_name '$user' <$user_email>",
"TESTBED: Membership Approved in '$project/$group' ",
TBMAIL("$user_name '$user' <$user_email>",
"Membership Approved in '$project/$group' ",
"\n".
"This message is to notify you that you have been approved\n".
"as a member of project/group $project/$group with\n".
......
......@@ -268,8 +268,8 @@ if ($nonsfile) {
</h3>\n";
if (1) {
mail("$user_name '$uid' <$user_email>",
"TESTBED: '$exp_pid' '$exp_id' New Experiment Created",
TBMAIL("$user_name '$uid' <$user_email>",
"New Experiment Created: $exp_pid/$exp_id",
"User: $uid\n".
"EID: $exp_id\n".
"PID: $exp_pid\n".
......
......@@ -50,6 +50,24 @@ function GENKEY ($name) {
return crypt("TB_"."$name"."_USR", strlen($name) + 13);
}
#
# Wrap up the mail function so we can prepend a tag to the subject
# line that indicates what testbed. Useful when multiple testbed
# email to the same list.
#
#
function TBMAIL($to, $subject, $message, $headers = 0)
{
global $THISHOMEBASE;
$subject = strtoupper($THISHOMEBASE) . ": $subject";
if ($headers)
return mail($to, $subject, $message, $headers);
else
return mail($to, $subject, $message);
}
#
# Internal errors should be reported back to the user simply. The actual
# error information should be emailed to the list for action. The script
......@@ -58,8 +76,8 @@ function GENKEY ($name) {
function TBERROR ($message, $death, $xmp = 0) {
global $TBMAIL_WWW, $TBMAIL_OPS, $TBMAILADDR;
mail($TBMAIL_OPS,
"TESTBED WEB ERROR REPORT",
TBMAIL($TBMAIL_OPS,
"WEB ERROR REPORT",
"\n".
"$message\n\n".
"Thanks,\n".
......
......@@ -145,8 +145,8 @@ if (($row = mysql_fetch_row($query_result)) == 0) {
$uid_name = $row[0];
$uid_email = $row[1];
mail($TBMAIL_OPS,
"TESTBED: Project $pid removed",
TBMAIL($TBMAIL_OPS,
"Project $pid removed",
"Project '$pid' has been removed by $uid ($uid_name).\n\n".
"Please remember to remove the backup directory in /proj\n\n",
"From: $uid_name <$uid_email>\n".
......
......@@ -117,8 +117,8 @@ echo "<center><h2>
#
TBUserInfo($uid, $uid_name, $uid_email);
mail($TBMAIL_OPS,
"TESTBED: User $target_uid removed",
TBMAIL($TBMAIL_OPS,
"User $target_uid removed",
"User '$target_uid' has been removed by $uid ($uid_name).\n\n".
"Please remember to remove the backup directory in /users\n\n",
"From: $uid_name <$uid_email>\n".
......
......@@ -131,7 +131,7 @@ if ((isset($new_password1) && strcmp($new_password1, "")) ||
}
}
else {
TBERROR("TESTBED: checkpass failure\n".
TBERROR("checkpass failure\n".
"$usr_name ($target_uid) just tried change his password\n".
"but checkpass pipe did not open (returned '$mypipe').", 1);
}
......@@ -188,8 +188,8 @@ $insert_result =
#
TBUserInfo($uid, $uid_name, $uid_email);
mail("$usr_name <$usr_email>",
"TESTBED: User Information for '$target_uid' Modified",
TBMAIL("$usr_name <$usr_email>",
"User Information for '$target_uid' Modified",
"\n".
"User information for '$target_uid' changed by '$uid'.\n".
"\n".
......
......@@ -228,7 +228,7 @@ else {
}
}
else {
TBERROR("TESTBED: checkpass failure\n".
TBERROR("checkpass failure\n".
"\n$usr_name ($proj_head_uid) just tried to set up a testbed ".
"account,\n".
"but checkpass pipe did not open (returned '$mypipe').", 1);
......@@ -256,8 +256,8 @@ if (! $returning) {
$key = GENKEY($proj_head_uid);
mail("$usr_name '$proj_head_uid' <$usr_email>",
"TESTBED: Your New User Key",
TBMAIL("$usr_name '$proj_head_uid' <$usr_email>",
"Your New User Key",
"\n".
"Dear $usr_name:\n\n".
" Here is your key to verify your account on the ".
......@@ -312,8 +312,8 @@ TBGroupUnixInfo($pid, $pid, $unix_gid, $unix_name);
#
# The mail message to the approval list.
#
mail($TBMAIL_APPROVAL,
"TESTBED: New Project '$pid' ($proj_head_uid)",
TBMAIL($TBMAIL_APPROVAL,
"New Project '$pid' ($proj_head_uid)",
"'$usr_name' wants to start project '$pid'.\n".
"Contact Info:\n".
"Name: $usr_name ($proj_head_uid)\n".
......
......@@ -93,8 +93,8 @@ if (! TBProjLeader($pid, $projleader)) {
}
TBUserInfo($projleader, $projleader_name, $projleader_email);
mail("$expleader_name <$expleader_email>",
"TESTBED: Please Swap or Terminate Experiment: $pid/$eid",
TBMAIL("$expleader_name <$expleader_email>",
"Please Swap or Terminate Experiment: $pid/$eid",
"Hi, this is an automated message from Emulab.Net.\n".
"\n".
"It appears that your experiment '$eid' in project '$pid' is inactive.\n".
......
......@@ -151,7 +151,7 @@ else {
}
}
else {
TBERROR("TESTBED: checkpass failure\n".
TBERROR("checkpass failure\n".
"\n$usr_name ($joining_uid) just tried to set up a testbed ".
"account,\n".
"but checkpass pipe did not open (returned '$mypipe').", 1);
......@@ -210,7 +210,8 @@ if (! $returning) {
$key = GENKEY($joining_uid);
mail("$usr_name '$joining_uid' <$usr_email>", "TESTBED: Your New User Key",
TBMAIL("$usr_name '$joining_uid' <$usr_email>",
"Your New User Key",
"\n".
"Dear $usr_name ($joining_uid):\n\n".
"\tHere is your key to verify your account on the ".
......@@ -285,8 +286,8 @@ $leader_uid = $row[2];
#
# The mail message to the approval list.
#
mail("$leader_name '$leader_uid' <$leader_email>",
"TESTBED: $joining_uid $pid Project Join Request",
TBMAIL("$leader_name '$leader_uid' <$leader_email>",
"Project Join Request: $joining_uid $pid",
"$usr_name is trying to join your group $gid in project $pid.\n".
"\n".
"Contact Info:\n".
......
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