fixing error which would cause setting of user role to fail

This commit is contained in:
Jake Dahn 2011-09-28 11:41:26 -07:00
parent eeee079a5d
commit 7cf2cb865a

View File

@ -198,13 +198,19 @@ def create(request):
user['password'],
user['tenant_id'],
True)
api.account_api(request).role_refs.add_for_tenant_user(
user['tenant_id'], user['id'],
settings.OPENSTACK_KEYSTONE_DEFAULT_ROLE)
messages.success(request,
'%s was successfully created.'
% user['id'])
try:
api.role_add_for_tenant_user(
request, user['tenant_id'], user['id'],
settings.OPENSTACK_KEYSTONE_DEFAULT_ROLE)
except api_exceptions.ApiException, e:
LOG.exception('ApiException while assigning\
role to new user: %s' % user['id'])
messages.error(request, 'Error assigning role to user: %s'
% e.message)
return redirect('syspanel_users')
except api_exceptions.ApiException, e: