Merge lp:~rharding/launchpad/ec2_land_928853 into lp:launchpad

Proposed by Richard Harding
Status: Merged
Approved by: Richard Harding
Approved revision: no longer in the source branch.
Merged at revision: 14766
Proposed branch: lp:~rharding/launchpad/ec2_land_928853
Merge into: lp:launchpad
Diff against target: 13 lines (+2/-1)
1 file modified
lib/devscripts/autoland.py (+2/-1)
To merge this branch: bzr merge lp:~rharding/launchpad/ec2_land_928853
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+92033@code.launchpad.net

Commit message

[r=adeuring][bug=928853] Add check for None before removing None from the set of stakeholder emails.

Description of the change

= Summary =
Landing via ec2 land throws a keyerorr exception when it attempts to build the list of notification emails.

== Proposed Fix ==
The code there blindly runs a set.remove(None) when None might not be in the set. Per docs, that raises a keyerror. Add a check to see if None is in the set first, then remove if that's the case.

== Demo and Q/A ==
ec2 land should work

To post a comment you must log in.
Revision history for this message
Abel Deuring (adeuring) :
review: Approve (code)
Revision history for this message
Robert Collins (lifeless) wrote :

Uhm,
emails.discard(None)

is the right way to do this :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/devscripts/autoland.py'
2--- lib/devscripts/autoland.py 2012-02-08 08:24:41 +0000
3+++ lib/devscripts/autoland.py 2012-02-08 14:02:26 +0000
4@@ -128,7 +128,8 @@
5 emails = set(
6 map(get_email,
7 [self._mp.source_branch.owner, self._launchpad.me]))
8- emails.remove(None)
9+ if None in emails:
10+ emails.remove(None)
11 return emails
12
13 def get_reviews(self):