[Buildbot-devel] problem with email notifications

Stephen Davis stephendavis at mac.com
Sat Jul 9 00:03:42 UTC 2005

I've got my builds set up to send build failure email notification to  
interested users in addition to myself.  Unfortunately, only I get  
the emails.  Here's a relevant snippet from my master.cfg:

status.append( mail.MailNotifier 
(    fromaddr="buildbot at builder.xxx.com",
["stephend at xxx.com"],
                                     lookup=MyLookup() ) )

My custom email lookup class "MyLookup" is:

class MyLookup:
     from buildbot import interfaces
     if implements:
         implements( interfaces.IEmailLookup )
         __implements__ = interfaces.IEmailLookup,
     def getAddress( self, user ):
         addresses = {    'user1' : user1 at xxx.com',
                         'user2' : 'user2 at xxx.com',
                         'stephend' : 'stephend at xxx.com'

         d = defer.Deferred()

         # if the user name isn't in the list, email won't get sent  
to that user
         d.callback( addresses[user] )
         return d

In status/mail.py the code is:

         # now, who is this message going to?
         dl = []
         recipients = self.extraRecipients[:]
         if self.sendToInterestedUsers and self.lookup:
             for u in build.getInterestedUsers():
                 d = defer.maybeDeferred(self.lookup.getAddress, u)
         d = defer.DeferredList(dl)
         d.addCallback(self._gotRecipients, recipients, m)
         return d

Why is there all the deferred stuff in the lookup method?  Are you  
assuming it could take a long time or something?  Just wondering.

Does the above look okay?


More information about the devel mailing list