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
Tony Breeds 7 years ago
parent 6255740534
commit 67b5119896

@ -334,7 +334,7 @@ def get_team_members(team_name, server, user, pw):
text = requests.get('http://%s/a/groups/%s/detail' % (server,
teams[team_name]['id']), auth=auth).text
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:
# This is a specific hack. This user is
# automatically included in core teams, but we don't want to include it