1 # vi: encoding=utf-8 ts=8 sts=4 sw=4 et
7 from io import StringIO
11 # this module, as it deals with internal error handling shouldn't
12 # import anything beside status
19 m.set_headers(to = status.admin, cc = "%s, %s" % (status.email, status.builder_list), subject = "fatal python exception")
20 m.write("%s\n" % trace)
21 m.write("during: %s\n" % status.get())
25 # don't use mailer.py; it safer this way
26 f = os.popen("/usr/sbin/sendmail -i -t", "w")
27 f.write("""Subject: builder failure
31 X-TLD-Builder: fatal error report
36 """ % (status.admin, status.email, status.builder_list,
37 time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()),
45 exctype, value = sys.exc_info()[:2]
46 if exctype == SystemExit:
49 traceback.print_exc(file = s, limit = 20)
51 log.alert("fatal python exception")
52 log.alert(s.getvalue())
53 log.alert("during: %s" % status.get())
55 sendmail(s.getvalue())