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,13 +39,18 @@ def get_launchpad_bug(bug):
lp = launchpad.Launchpad.login_anonymously('grabbing bugs',
'production',
LPCACHEDIR)
lp_bug = lp.bugs[bug]
bugdata = {'name': lp_bug.title}
projects = ", ".join(map(lambda x: "(%s - %s)" %
(x.bug_target_name, x.status),
lp_bug.bug_tasks))
bugdata['affects'] = projects
bugdata['reviews'] = get_open_reviews(bug)
try:
lp_bug = lp.bugs[bug]
bugdata = {'name': lp_bug.title}
projects = ", ".join(map(lambda x: "(%s - %s)" %
(x.bug_target_name, x.status),
lp_bug.bug_tasks))
bugdata['affects'] = projects
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