handle possible private bugs in the graph

Apparently people are marking public openstack bugs private some
times. In these cases we have to handle the possibility that looking
for the bug returns a keyerror, and move on gracefully.

Change-Id: Icc30843bcc9cfc6822dc7791959c1d2b45765e01
This commit is contained in:
Sean Dague 2014-11-18 14:51:58 -05:00
parent fa8c530f95
commit 3a7e95de47

View File

@ -39,6 +39,7 @@ def get_launchpad_bug(bug):
lp = launchpad.Launchpad.login_anonymously('grabbing bugs', lp = launchpad.Launchpad.login_anonymously('grabbing bugs',
'production', 'production',
LPCACHEDIR) LPCACHEDIR)
try:
lp_bug = lp.bugs[bug] lp_bug = lp.bugs[bug]
bugdata = {'name': lp_bug.title} bugdata = {'name': lp_bug.title}
projects = ", ".join(map(lambda x: "(%s - %s)" % projects = ", ".join(map(lambda x: "(%s - %s)" %
@ -46,6 +47,10 @@ def get_launchpad_bug(bug):
lp_bug.bug_tasks)) lp_bug.bug_tasks))
bugdata['affects'] = projects bugdata['affects'] = projects
bugdata['reviews'] = get_open_reviews(bug) bugdata['reviews'] = get_open_reviews(bug)
except KeyError:
# if someone makes a bug private, we lose access to it.
bugdata = dict(name='Unknown (Private Bug)',
affects='Unknown (Private Bug)', reviews=[])
return bugdata return bugdata