Merge "Fixes traceback if group name attribute is missing"

This commit is contained in:
Jenkins 2016-12-08 20:55:57 +00:00 committed by Gerrit Code Review
commit 8ce29a42c7
2 changed files with 11 additions and 2 deletions

View File

@ -336,7 +336,10 @@ class UpdateProjectGroupsAction(workflows.MembershipAction):
domain=domain_id)
except Exception:
exceptions.handle(request, err_msg)
groups_list = [(group.id, group.name) for group in all_groups]
# some backends (e.g. LDAP) do not provide group names
groups_list = [
(group.id, getattr(group, 'name', group.id))
for group in all_groups]
# Get list of roles
role_list = []

View File

@ -237,7 +237,13 @@ def data(TEST):
'project_id': '2',
'domain_id': '2'}
group4 = groups.Group(groups.GroupManager(None), group_dict)
TEST.groups.add(group, group2, group3, group4)
# this group intentionally only has id/domain_id to match data
# returned from Keystone backends like LDAP
group_dict = {'id': "5",
'domain_id': '2'}
group5 = groups.Group(groups.GroupManager(None), group_dict)
TEST.groups.add(group, group2, group3, group4, group5)
role_assignments_dict = {'user': {'id': '1'},
'role': {'id': '1'},