Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
2019b432
Commit
2019b432
authored
Jul 29, 2018
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
All setting the Brand in the metadata info, and use that for sending the
email, so that it has the correct subject tag.
parent
d40b0947
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
tbsetup/libaudit.pm.in
tbsetup/libaudit.pm.in
+19
-8
No files found.
tbsetup/libaudit.pm.in
View file @
2019b432
#
!/usr/bin/perl -w
#
#
Copyright
(
c
)
2000
-
201
7
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2000
-
201
8
University
of
Utah
and
the
Flux
Group
.
#
#
{{{
EMULAB
-
LICENSE
#
...
...
@@ -47,6 +47,7 @@ use Carp;
#
Testbed
Support
libraries
#
use
libtestbed
;
use
Brand
;
my
$
TBOPS
=
"@TBOPSEMAIL@"
;
my
$
TBAUDIT
=
"@TBAUDITEMAIL@"
;
...
...
@@ -85,6 +86,9 @@ my $fancy = 0;
#
We
be
forked
.
my
$
forked
=
0
;
#
Branding
for
email
.
Set
via
audit
info
.
my
$
brand
;
#
Extra
info
used
when
AUDIT_FANCY
is
set
my
%
AUDIT_INFO
;
...
...
@@ -157,6 +161,7 @@ sub AuditStart($;$$)
$
savelog
=
0
;
$
fancy
=
0
;
$
forked
=
0
;
$
brand
=
Brand
->
Create
();
#
Default
Brand
.
#
Logging
instead
of
"auditing"
...
if
(
defined
($
options
))
{
...
...
@@ -506,7 +511,7 @@ sub SendAuditMail($)
my $FROM = "$GCOS <${USERNAME}\@${OURDOMAIN}>";
if (! $logonly) {
SENDMAIL
($TBAUDIT, $subject, $body, $FROM, undef, ());
$brand->SendEmail
($TBAUDIT, $subject, $body, $FROM, undef, ());
}
# Success and no log ...
...
...
@@ -567,7 +572,7 @@ sub SendAuditMail($)
}
# Leave logfile if sendmail fails.
if (
SENDMAIL
($TO, $subject, $body, $FROM, $HDRS, @FILES)) {
if (
$brand->SendEmail
($TO, $subject, $body, $FROM, $HDRS, @FILES)) {
unlink($logfile)
if (defined($logfile) && !$savelog);
}
...
...
@@ -631,11 +636,14 @@ sub SendFancyMail($)
my $what = "Failed: $SCRIPTNAME";
$what = $AUDIT_INFO{failure_frag} if defined $AUDIT_INFO{failure_frag};
$which = $AUDIT_INFO{which};
# Ick.
local $libtestbed::MAILTAG = $brand->EmailTag();
$sendmail_res
= tblog_email_error($d, $TO, $what, $which,
$FROM, $extra_cc, "Cc: $TBOPS",
$prefix, @FILES);
$prefix, @FILES);
} else {
my $subject = "$SCRIPTNAME succeeded";
...
...
@@ -649,7 +657,7 @@ sub SendFancyMail($)
$HDRS .= "Bcc: $TBLOGS";
$sendmail_res
=
SENDMAIL
($TO, $subject, $body, $FROM, $HDRS, @FILES);
=
$brand->SendEmail
($TO, $subject, $body, $FROM, $HDRS, @FILES);
}
if ($sendmail_res) {
...
...
@@ -667,7 +675,8 @@ my %AUDIT_METAINFO =
failure_frag => '
string
', # ie "Bla Failure"
message => '
string
',
to => '
list
', # Send audit mail to these people
cc => '
list
'); # Cc audit mail to these people
cc => '
list
', # Cc audit mail to these people
brand => '
brand
'); # Brand object for sendmail
#
# AddAuditInfo($key, $value)
...
...
@@ -689,7 +698,7 @@ sub AddAuditInfo ($$) {
}
if ($AUDIT_METAINFO{$key} eq 'string') {
$AUDIT_INFO{$key} = $value;
return 1;
...
...
@@ -698,6 +707,8 @@ sub AddAuditInfo ($$) {
push @{$AUDIT_INFO{$key}}, $value;
return 1;
} elsif ($AUDIT_METAINFO{$key} eq 'brand') {
$brand = $value;
} else {
carp "
Unknown
key
,
\
"$key
\"
in AddAuditInfo"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment