The branch, master has been updated
       via  f6aa956 Keep connection open while sending dead host notifications, 
only mark mail sent when not using dry run.
      from  6b5ee74 Honor dry_run in import-and-analyse.

http://gitweb.samba.org/?p=build-farm.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit f6aa956149f3c1d68d386fc2c87e6e3f56895850
Author: Jelmer Vernooij <jel...@samba.org>
Date:   Fri Nov 12 19:59:08 2010 +0100

    Keep connection open while sending dead host notifications, only mark mail 
sent when not using dry run.

-----------------------------------------------------------------------

Summary of changes:
 mail-dead-hosts.py |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/mail-dead-hosts.py b/mail-dead-hosts.py
index 1a73974..f9a5807 100755
--- a/mail-dead-hosts.py
+++ b/mail-dead-hosts.py
@@ -32,10 +32,11 @@ parser.add_option("--dry-run", help="Don't actually send 
any emails.", action="s
 buildfarm = BuildFarm()
 db = buildfarm.hostdb
 
+smtp = smtplib.SMTP()
+smtp.connect()
+
 hosts = db.dead_hosts(7 * 86400)
 for host in hosts:
-    db.sent_dead_mail(host.name)
-
     if host.last_update:
         last_update = time.strftime("%a %b %e %H:%M:%S %Y", 
time.gmtime(host.last_update))
     else:
@@ -73,7 +74,6 @@ The Build Farm administration team.
     if opts.dry_run:
         print msg.as_string()
     else:
-        s = smtplib.SMTP()
-        s.connect()
-        s.send(msg["From"], [msg["To"]], msg.as_string())
-        s.quit()
+        smtp.send(msg["From"], [msg["To"]], msg.as_string())
+        db.sent_dead_mail(host.name)
+smtp.quit()


-- 
build.samba.org

Reply via email to