Fix the choice of default_role
When there are two similiar roles in the context, such as "baremetal_admin", "admin", the rally will chose baremetal_admin rather than admin in create_user. To fix this, use "==" instead of "in". Change-Id: I6db08e0cd1b2ecfcc258298642dfe3208e00373e
This commit is contained in:
parent
2d594c22eb
commit
0de13fc606
@ -104,15 +104,22 @@ class KeystoneV3Service(service.Service, keystone_common.KeystoneMixin):
|
|||||||
|
|
||||||
if project_id:
|
if project_id:
|
||||||
# we can't setup role without project_id
|
# we can't setup role without project_id
|
||||||
for role in self.list_roles():
|
roles = self.list_roles()
|
||||||
if default_role in role.name.lower():
|
for role in roles:
|
||||||
|
if default_role == role.name.lower():
|
||||||
self.add_role(role_id=role.id,
|
self.add_role(role_id=role.id,
|
||||||
user_id=user.id,
|
user_id=user.id,
|
||||||
project_id=project_id)
|
project_id=project_id)
|
||||||
break
|
return user
|
||||||
else:
|
for role in roles:
|
||||||
LOG.warning("Unable to set %s role to created user." %
|
if default_role == role.name.lower().strip("_"):
|
||||||
default_role)
|
self.add_role(role_id=role.id,
|
||||||
|
user_id=user.id,
|
||||||
|
project_id=project_id)
|
||||||
|
return user
|
||||||
|
|
||||||
|
LOG.warning("Unable to set %s role to created user." %
|
||||||
|
default_role)
|
||||||
return user
|
return user
|
||||||
|
|
||||||
@atomic.action_timer("keystone_v3.create_users")
|
@atomic.action_timer("keystone_v3.create_users")
|
||||||
|
Loading…
Reference in New Issue
Block a user