Filter out members without usernames

It seems some groups (eg trove-stable-maint) contain members that lack a
'username' attribute.

This causes reviewstats to stack trace.

Fix that by filtering out these problematic users.

Change-Id: I5b5dd602a7ccf8be56e8227a3037f7d426087a06
This commit is contained in:
Tony Breeds 2016-04-06 14:11:35 +10:00
parent 6255740534
commit 67b5119896
1 changed files with 1 additions and 1 deletions

View File

@ -334,7 +334,7 @@ def get_team_members(team_name, server, user, pw):
text = requests.get('http://%s/a/groups/%s/detail' % (server, text = requests.get('http://%s/a/groups/%s/detail' % (server,
teams[team_name]['id']), auth=auth).text teams[team_name]['id']), auth=auth).text
team = json.loads(text[text.find('{'):]) team = json.loads(text[text.find('{'):])
members_list = [n['username'] for n in team['members']] members_list = [n['username'] for n in team['members'] if 'username' in n]
if 'hudson-openstack' in members_list: if 'hudson-openstack' in members_list:
# This is a review.openstack.org specific hack. This user is # This is a review.openstack.org specific hack. This user is
# automatically included in core teams, but we don't want to include it # automatically included in core teams, but we don't want to include it