Opened 2 years ago

Closed 22 months ago

#3194 closed defect (fixed)

build.getResponsibleUsers() returns None when sending mail

Reported by: daniel@… Owned by:
Priority: major Milestone: 0.9.0
Version: master Keywords: mail, buildstep
Cc:

Description

When using MailNotifier? like this:

mn = status.MailNotifier(fromaddr=“name@gmail.com",
                         sendToInterestedUsers=True,
                         useTls=True,
                         relayhost="smtp.gmail.com", smtpPort=587,
                         smtpUser=“name@gmail.com",
                         smtpPassword=“pass_removed”)
c['status'] = []
c['status'].append(m)

I get this exception:

2015-02-05 10:18:35+0100 [-] Exception caught notifying <buildbot.status.mail.MailNotifier object at 0x10f2d33d0> of buildFinished event
2015-02-05 10:18:35+0100 [-] Unhandled Error
	Traceback (most recent call last):
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/status/build.py", line 267, in buildFinished
	    w.callback(self)
	  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/defer.py", line 382, in callback
	    self._startRunCallbacks(result)
	  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/defer.py", line 490, in _startRunCallbacks
	    self._runCallbacks()
	  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/twisted/internet/defer.py", line 577, in _runCallbacks
	    current.result = callback(current.result, *args, **kw)
	--- <exception caught here> ---
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/status/builder.py", line 582, in _buildFinished
	    w.buildFinished(name, s, results)
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/status/mail.py", line 554, in buildFinished
	    return self.buildMessage(name, [build], results)
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/status/mail.py", line 752, in buildMessage
	    build=build, results=build.results)
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/status/mail.py", line 733, in buildMessageDict
	    self.master_status)
	  File "/Library/Python/2.7/site-packages/buildbot-0.9.0-py2.7.egg/buildbot/status/mail.py", line 212, in defaultMessage
	    text += "Blamelist: %s\n" % ",".join(build.getResponsibleUsers())
	exceptions.TypeError: sequence item 0: expected string, NoneType

This happens when I get changes from a Git repository. I'm currently using PBChangeSource() and the contrib/github_buildbot.py to get a notification from Github. I don't think that is related though and GitPoller? should give the same behaviour.

Change History (7)

comment:1 Changed 2 years ago by daniel@…

So I spent some time looking at this issue and the problem is at this line:

https://github.com/buildbot/buildbot/blob/master/master/buildbot/process/build.py#L144

The problem here is that even if source.patch_info set source.path_info[0] is None which in my test case results in this list

[None, user <email>]

I'm unsure how to fix this bug though. Adding a check here is easy but I figured that the real issues may be somewhere else in the code (that sets patch_info)

comment:2 Changed 2 years ago by daniel@…

  • Keywords buildstep added

comment:3 Changed 2 years ago by daniel@…

I have made some more investigation and these lines

https://github.com/buildbot/buildbot/blob/master/master/buildbot/process/buildrequest.py#L230

ss.patch = None
ss.patch_info = (None, None)

It looks like patch_info is always set which means the check in build.py is incorrect and the check should really be if patch is None and not check the patch_info

comment:4 Changed 2 years ago by dustin

  • Keywords osx removed
  • Milestone changed from undecided to 0.9.0
  • Type changed from undecided to defect

Sounds like you've found the problem -- want to make a patch?

comment:6 Changed 2 years ago by daniel@…

Yeah. I see you found the patch :)

I need someone to comment on my comment though as I think there is an issue with the test as compared to how the code is implemented.

comment:7 Changed 22 months ago by dustin

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.