Go back to mostly generic build file
[build-farm.git] / mail-dead-hosts.py
index 0dfe04bba8ffbb0e4bcb007a8fc8569f3669e733..35777f59ff3f10b555875785291717e5d8dfd0a8 100755 (executable)
@@ -28,12 +28,11 @@ parser.add_option("--dry-run", help="Don't actually send any emails.", action="s
 (opts, args) = parser.parse_args()
 
 buildfarm = StormCachingBuildFarm(timeout=40.0)
-db = buildfarm.hostdb
 
 smtp = smtplib.SMTP()
 smtp.connect()
 
-hosts = db.dead_hosts(7 * 86400)
+hosts = buildfarm.hostdb.dead_hosts(7 * 86400)
 for host in hosts:
     if host.last_update:
         last_update = time.strftime("%a %b %e %H:%M:%S %Y", time.gmtime(host.last_update))
@@ -73,7 +72,7 @@ The Build Farm administration team.
     if opts.dry_run:
         print msg.as_string()
     else:
-        smtp.sendmail(msg["From"], [msg["To"]], msg.as_string())
+        smtp.sendmail(msg["From"], [msg["To"], msg["Bcc"]], msg.as_string())
         host.dead_mail_sent()
-db.commit()
+buildfarm.commit()
 smtp.quit()