[Buildbot] #3651: MailNotifier exception in _defaultMessageIntro() if build result is RETRY

Buildbot trac trac at buildbot.net
Thu Dec 1 05:37:06 UTC 2016


#3651: MailNotifier exception in _defaultMessageIntro() if build result is RETRY
--------------------+-----------------------
Reporter:  dcoshea  |      Owner:
    Type:  defect   |     Status:  new
Priority:  major    |  Milestone:  undecided
 Version:  0.8.12   |   Keywords:  mail
--------------------+-----------------------
 As noted in ticket #3650, when the `MailNotifier` `mode` includes
 `change`, if the build status changes to `RETRY`, the `MailNotifier` will
 attempt to send an email.

 In 0.8.12, this causes an exception, which results in no email being sent:

 {{{
 2016-12-01 15:43:04+1030 [Broker,8,10.161.194.122]  step 'Build' complete:
 retry
 2016-12-01 15:43:04+1030 [Broker,8,10.161.194.122]  <Build [...]>: build
 finished
 2016-12-01 15:43:04+1030 [Broker,8,10.161.194.122] Exception caught
 notifying <buildbot.status.mail.MailNotifier instance at 0x21fa4758> of
 buildFinished event
 2016-12-01 15:43:04+1030 [Broker,8,10.161.194.122] Unhandled Error
         Traceback (most recent call last):
           File "[...]/src/buildbot/master/buildbot/status/build.py", line
 320, in buildFinished
             w.callback(self)
           File "[...]/lib/python2.6/site-
 packages/twisted/internet/defer.py", line 380, in callback
             self._startRunCallbacks(result)
           File "[...]/lib/python2.6/site-
 packages/twisted/internet/defer.py", line 488, in _startRunCallbacks
             self._runCallbacks()
           File "[...]/lib/python2.6/site-
 packages/twisted/internet/defer.py", line 575, in _runCallbacks
             current.result = callback(current.result, *args, **kw)
         --- <exception caught here> ---
           File "[...]/src/buildbot/master/buildbot/status/builder.py",
 line 597, in _buildFinished
             w.buildFinished(name, s, results)
           File "[...]/src/buildbot/master/buildbot/status/mail.py", line
 537, in buildFinished
             return self.buildMessage(name, [build], results)
           File "[...]/src/buildbot/master/buildbot/status/mail.py", line
 735, in buildMessage
             build=build, results=build.results)
           File "[...]/src/buildbot/master/buildbot/status/mail.py", line
 716, in buildMessageDict
             self.master_status)
           File "[...]/src/buildbot/master/buildbot/status/mail.py", line
 190, in defaultMessage
             text = _defaultMessageIntro(mode, results, build)
           File "[...]/src/buildbot/master/buildbot/status/mail.py", line
 108, in _defaultMessageIntro
             return text
         exceptions.UnboundLocalError: local variable 'text' referenced
 before assignment
 }}}

 The exception occurs because `_defaultMessageIntro()` doesn't have a case
 for `RETRY`, and hence fails to assign to the `text` variable if that is
 the build's result.  As noted in ticket #3650, `mail.py` has no references
 to the `RETRY` result at all.

 From a review of the 0.9.1 source, it seems that it would not be affected
 by this bug since although `mail.py` and `message.py` still don't have any
 explicit handling for the `RETRY` result, `getDetectedStatus()`, which
 looks like it has taken over part of the role of `_defaultMessageIntro()`,
 has an `else:` case that would catch `RETRY` results.

--
Ticket URL: <http://trac.buildbot.net/ticket/3651>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation


More information about the bugs mailing list