[Asterisk-code-review] Add options to send crash reports via email (testsuite[master])

Jonathan Rose asteriskteam at digium.com
Tue Oct 27 16:16:01 CDT 2015


Jonathan Rose has posted comments on this change.

Change subject: Add options to send crash reports via email
......................................................................


Patch Set 2:

(3 comments)

https://gerrit.asterisk.org/#/c/1539/2/runtests.py
File runtests.py:

Line 188:         try:
        :             f = open("crash-mail-config.yaml", "r")
        :         except IOError:
        :             print "Failed to open crash-mail-config.yaml"
        :             return -1
        :         except:
        :             print "Unexpected error: %s" % sys.exc_info()[0]
        :             return -1
        : 
        :         email_config = yaml.load(f)
        :         f.close()
> I am surprised this pattern hasn't been abstracted into its own method or f
It's probably because it'd be awkward to have it in a library somewhere because it relies on print statements and the like. Normally we'd rely on loggers and such for this sort of stuff, but the runtests.py script runs outside the context of reactor and all that stuff, so it relies a lot less on the reactor-intended code you typically find in lib/python.

I went ahead and split it out a bit.


Line 219: subject = "Subject: {0}\n\n".format(subject)
> Is there any easy way to include the name or category of the test that gene
I asked Scott about this yesterday... the only really easy way to get the name of the test as far as I can tell would be to include the path to the backtrace file which at least shows where the test files are (example: ./logs/manager/mixmonitor/backtrace_5753.txt) -- however, we don't really want to include this in the subject.


Line 224:         try:
        :             import smtplib
        :         except ImportError:
        :             print "Failed to import smtplib"
        :             return -1
        : 
        :         try:
        :             smtpObj = smtplib.SMTP(email_server)
        :             smtpObj.set_debuglevel(email_debug)
        :             smtpObj.sendmail(sender, recipients, email_text)
        :         except smtplib.SMTPServerDisconnected:
        :             print "Failed to connect to SMTP Server"
        :             return -1
        :         except smtplib.SMTPException as smtp_exception:
        :             print "Failed to send crash report due to unhandled SMTPException"
        :             raise(smtp_exception)
> This could be abstracted into it's own method (or function). e.g. def send_
I stuck this in a library for now... might be wise to come along later and address its reliance on print statements.


-- 
To view, visit https://gerrit.asterisk.org/1539
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I17def41f15294a48754269d9c42aa649389840ad
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Jonathan Rose <jrose at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Ashley Sanders <asanders at digium.com>
Gerrit-Reviewer: Jonathan Rose <jrose at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list