[Buildbot] #2918: GerritChangeSource breaks when submitter has no configured email address
Buildbot trac
trac at buildbot.net
Mon Sep 29 08:20:37 UTC 2014
#2918: GerritChangeSource breaks when submitter has no configured email address
---------------------+-----------------------
Reporter: waitzmar | Owner:
Type: defect | Status: new
Priority: major | Milestone: undecided
Version: 0.8.9 | Keywords: gerrit
---------------------+-----------------------
I use an import script to automatically import changes from some other
repository into a Gerrit branch.
This import script authenticates as a Gerrit user which does not have any
configured email address.
Every time that branch is updated I get:
{{{
Traceback (most recent call last):
[...]
File
".../buildbot-0.8.9-py2.6.egg/buildbot/changes/gerritchangesource.py",
line 172, in eventReceived_ref_updated
event["submitter"]["name"], event["submitter"]["email"])
exceptions.KeyError: 'email'
}}}
The code already checks if `event["submitter"]` exists, but it does not
check submitter.name or submitter.email.
Proposal:
{{{
--- a/buildbot/changes/gerritchangesource.py
+++ b/buildbot/changes/gerritchangesource.py
@@ -168,8 +168,11 @@
author = "gerrit"
if "submitter" in event:
- author = "%s <%s>" % (
- event["submitter"]["name"], event["submitter"]["email"])
+ submitter = event["submitter"]
+ info = []
+ if "name" in submitter: info.append(submitter["name"])
+ if "email" in submitter: info.append("<%s>" %
submitter["email"])
+ if info: author = " ".join(info)
return self.addChange(dict(
author=author,
}}}
--
Ticket URL: <http://trac.buildbot.net/ticket/2918>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation
More information about the bugs
mailing list