Check that the owner of a change has name defined

Sometimes Gerrit might not return owner name
due to some internal misconfiguration or database
problem. Since we are using owner name here to
generate the name of a local git branch, instead
of failing here we should try to just go ahead
with 'unknown'.

More information about this error:

https://bugzilla.wikimedia.org/show_bug.cgi?id=40061#c5
https://gerrit.wikimedia.org/r/#/c/37771/

Change-Id: Icaa9baa453e3fd7d54adf9138a9435e4271cee0a
This commit is contained in:
Krenair 2013-01-04 02:05:26 +00:00 committed by Jeremy Stanley
parent cac1cb7a6b
commit 47d99c7756

View File

@ -712,9 +712,9 @@ def download_review(review, masterbranch, remote):
topic = review
except KeyError:
topic = review
if review_info.get('owner'):
try:
author = re.sub('\W+', '_', review_info['owner']['name']).lower()
else:
except KeyError:
author = 'unknown'
branch_name = "review/%s/%s" % (author, topic)