git://git.onelab.eu
/
monitor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Uses CoMon's ability to find 'upness' to email. Changed queueing between threads...
[monitor.git]
/
mailer.py
diff --git
a/mailer.py
b/mailer.py
index
9ea66f7
..
7e2e629
100755
(executable)
--- a/
mailer.py
+++ b/
mailer.py
@@
-21,8
+21,6
@@
def siteId(hostname):
if len(site_id) == 1:
loginbase = api.AnonAdmGetSites (anon, site_id, ["login_base"])
return loginbase[0]['login_base']
if len(site_id) == 1:
loginbase = api.AnonAdmGetSites (anon, site_id, ["login_base"])
return loginbase[0]['login_base']
- else:
- raise "Unknown host"
def email (subject, text, to, cc = None):
"""Create a mime-message that will render HTML in popular
def email (subject, text, to, cc = None):
"""Create a mime-message that will render HTML in popular
@@
-67,12
+65,15
@@
def email (subject, text, to, cc = None):
msg = out.getvalue()
out.close()
msg = out.getvalue()
out.close()
- server = smtplib.SMTP(MTA)
- server.sendmail(FROM, (to,cc), msg)
- server.quit()
+
#
server = smtplib.SMTP(MTA)
+
#
server.sendmail(FROM, (to,cc), msg)
+
#
server.quit()
if __name__=="__main__":
if __name__=="__main__":
- import smtplib
- import emailTxt
-
- email('DISREGARD', emailTxt.mailtxt.STANDARD % {'hostname': "ALICE.cs.princeton.edu"}, "tech-" + siteId("alice.cs.princeton.edu") + "@sites.planet-lab.org")
+ import smtplib
+ import emailTxt
+ id = siteId("alice.cs.princeeton.edu")
+ if id:
+ email('TEST', emailTxt.mailtxt.STANDARD % {'hostname': "ALICE.cs.princeton.edu"}, "tech-" + id + "@sites.planet-lab.org")
+ else:
+ print "No dice."