summaryrefslogtreecommitdiff
path: root/openstackclient/identity/v3/role_assignment.py
diff options
context:
space:
mode:
authorHenry Nash <henryn@linux.vnet.ibm.com>2016-02-23 11:42:40 +0000
committerSteve Martinelli <s.martinelli@gmail.com>2016-08-10 20:32:55 +0000
commit5eb7e626b18b033f97f3cf10f2791529f9d75789 (patch)
tree1b371a8835abe4dfbf82dbc8003a08621138bb5b /openstackclient/identity/v3/role_assignment.py
parent0b91368164acc596bf97fe4073083e26892f5b1a (diff)
downloadpython-openstackclient-5eb7e626b18b033f97f3cf10f2791529f9d75789.tar.gz
Add support for domain specific roles
A role entity can now be specified as domain specific. Closes-bug: #1606105 Change-Id: I564cf3da1d61f5bfcf85be591480d2f5c8d694a0
Diffstat (limited to 'openstackclient/identity/v3/role_assignment.py')
-rw-r--r--openstackclient/identity/v3/role_assignment.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/openstackclient/identity/v3/role_assignment.py b/openstackclient/identity/v3/role_assignment.py
index 6177d1a5..d25cc6ce 100644
--- a/openstackclient/identity/v3/role_assignment.py
+++ b/openstackclient/identity/v3/role_assignment.py
@@ -36,6 +36,7 @@ class ListRoleAssignment(command.Lister):
metavar='<role>',
help=_('Role to filter (name or ID)'),
)
+ common.add_role_domain_option_to_parser(parser)
parser.add_argument(
'--names',
action="store_true",
@@ -91,10 +92,15 @@ class ListRoleAssignment(command.Lister):
auth_ref = self.app.client_manager.auth_ref
role = None
+ role_domain_id = None
+ if parsed_args.role_domain:
+ role_domain_id = common.find_domain(identity_client,
+ parsed_args.role_domain).id
if parsed_args.role:
role = utils.find_resource(
identity_client.roles,
parsed_args.role,
+ domain_id=role_domain_id
)
user = None
@@ -205,6 +211,12 @@ class ListRoleAssignment(command.Lister):
if hasattr(assignment, 'role'):
if include_names:
+ # TODO(henry-nash): If this is a domain specific role it
+ # would be good show this as role@domain, although this
+ # domain info is not yet included in the response from the
+ # server. Although we could get it by re-reading the role
+ # from the ID, let's wait until the server does the right
+ # thing.
setattr(assignment, 'role', assignment.role['name'])
else:
setattr(assignment, 'role', assignment.role['id'])