[llvm-commits] [zorg] r110925 - in /zorg/trunk/lnt/lnt/util: ImportData.py NTEmailReport.py
Daniel Dunbar
daniel at zuster.org
Thu Aug 12 09:03:53 PDT 2010
Author: ddunbar
Date: Thu Aug 12 11:03:53 2010
New Revision: 110925
URL: http://llvm.org/viewvc/llvm-project?rev=110925&view=rev
Log:
LNT: Always generate reports on import, even if we don't plan on sending them
anywhere.
Modified:
zorg/trunk/lnt/lnt/util/ImportData.py
zorg/trunk/lnt/lnt/util/NTEmailReport.py
Modified: zorg/trunk/lnt/lnt/util/ImportData.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/util/ImportData.py?rev=110925&r1=110924&r2=110925&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/util/ImportData.py (original)
+++ zorg/trunk/lnt/lnt/util/ImportData.py Thu Aug 12 11:03:53 2010
@@ -45,16 +45,17 @@
result['load_time'] = time.time() - startTime
# Find the email address for this machine's results.
- toAddress = None
- email_config = config.databases[db_name].email_config
- if email_config.enabled:
- # Find the machine name.
- machineName = str(data.get('Machine',{}).get('Name'))
- toAddress = email_config.get_to_address(machineName)
- if toAddress is None:
- result['error'] = ("unable to match machine name "
- "for test results email address!")
- return result
+ toAddress = email_config = None
+ if not disable_email:
+ email_config = config.databases[db_name].email_config
+ if email_config.enabled:
+ # Find the machine name.
+ machineName = str(data.get('Machine',{}).get('Name'))
+ toAddress = email_config.get_to_address(machineName)
+ if toAddress is None:
+ result['error'] = ("unable to match machine name "
+ "for test results email address!")
+ return result
importStartTime = time.time()
try:
@@ -71,12 +72,10 @@
# Record the original run this is a duplicate of.
result['original_run'] = run.id
- if not disable_email and toAddress is not None:
- result['report_to_address'] = toAddress
- NTEmailReport.emailReport(db, run,
- "%s/db_%s/" % (config.zorgURL, db_name),
- email_config.host, email_config.from_address,
- toAddress, success, commit)
+ result['report_to_address'] = toAddress
+ NTEmailReport.emailReport(db, run,
+ "%s/db_%s/" % (config.zorgURL, db_name),
+ email_config, toAddress, success, commit)
result['added_machines'] = db.getNumMachines() - numMachines
result['added_runs'] = db.getNumRuns() - numRuns
Modified: zorg/trunk/lnt/lnt/util/NTEmailReport.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/util/NTEmailReport.py?rev=110925&r1=110924&r2=110925&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/util/NTEmailReport.py (original)
+++ zorg/trunk/lnt/lnt/util/NTEmailReport.py Thu Aug 12 11:03:53 2010
@@ -37,7 +37,7 @@
emailReport(db, run, baseurl, host, from_, to)
-def emailReport(db, run, baseurl, host, from_, to, was_added=True,
+def emailReport(db, run, baseurl, email_config, to, was_added=True,
will_commit=True):
import email.mime.multipart
import email.mime.text
@@ -45,16 +45,22 @@
subject, report, html_report = getReport(db, run, baseurl, was_added,
will_commit)
+ # Ignore if no to address was given, we do things this way because of the
+ # awkward way we collect result information as part of generating the email
+ # report.
+ if email_config is None or to is None:
+ return
+
# Generate a plain text message if we have no html report.
if not html_report:
msg = email.mime.text.MIMEText(report)
msg['Subject'] = subject
- msg['From'] = from_
+ msg['From'] = email_config.from_address
msg['To'] = to
else:
msg = email.mime.multipart.MIMEMultipart('alternative')
msg['Subject'] = subject
- msg['From'] = from_
+ msg['From'] = email_config.from_address
msg['To'] = to
# Attach parts into message container, according to RFC 2046, the last
@@ -63,8 +69,8 @@
msg.attach(email.mime.text.MIMEText(report, 'plain'))
msg.attach(email.mime.text.MIMEText(html_report, 'html'))
- s = smtplib.SMTP(host)
- s.sendmail(from_, [to], msg.as_string())
+ s = smtplib.SMTP(email_config.host)
+ s.sendmail(email_config.from_address, [to], msg.as_string())
s.quit()
def findPreceedingRun(query, run):
More information about the llvm-commits
mailing list