assignment controller error path fix

Assignment controller error path code updated to reflect a change in the
dictionary format.

Closes-Bug: #1359376

Change-Id: I5358f8d61b60ea853fb4e2af0b05031a25c4ae6d
This commit is contained in:
Matthew Edmonds 2014-08-21 07:37:06 -04:00
parent de2c6e15b9
commit e15b105ed7

View File

@ -683,19 +683,24 @@ class RoleAssignmentV3(controller.V3Controller):
# The group is missing, which should not happen since # The group is missing, which should not happen since
# group deletion should remove any related assignments, so # group deletion should remove any related assignments, so
# log a warning # log a warning
if 'domain' in ref: target = 'Unknown'
target = 'Domain: %s' % ref['domain'].get('domain_id') # Should always be a domain or project, but since to get
elif 'project' in ref: # here things have gone astray, let's be cautious.
target = 'Project: %s' % ref['project'].get('project_id') if 'scope' in ref:
else: if 'domain' in ref['scope']:
# Should always be a domain or project, but since to get dom_id = ref['scope']['domain'].get('id', 'Unknown')
# here things have gone astray, let's be cautious. target = 'Domain: %s' % dom_id
target = 'Unknown' elif 'project' in ref['scope']:
proj_id = ref['scope']['project'].get('id', 'Unknown')
target = 'Project: %s' % proj_id
role_id = 'Unknown'
if 'role' in ref and 'id' in ref['role']:
role_id = ref['role']['id']
LOG.warning( LOG.warning(
_('Group %(group)s not found for role-assignment - ' _('Group %(group)s not found for role-assignment - '
'%(target)s with Role: %(role)s'), { '%(target)s with Role: %(role)s'), {
'group': ref['group_id'], 'target': target, 'group': ref['group']['id'], 'target': target,
'role': ref.get('role_id')}) 'role': role_id})
return members return members
def _build_user_assignment_equivalent_of_group( def _build_user_assignment_equivalent_of_group(