From 337d013c94378a4b3f0e8f90e4f5bd745448658f Mon Sep 17 00:00:00 2001 From: David Rosales Date: Fri, 29 Apr 2016 12:12:52 -0500 Subject: Use resource id when name given for identity show Currently a user is allowed to specify either a resource ID or name when running openstack identity comands. In some cases, when a name is specified instead of an ID, the command will return as not able to find the resource when it in fact does exist. The changes here are to check the client against the token on such requests and to extract the ID of the resource specified if enough information exists between the two. We then use the ID associated with the resource to complete the user requests. Change-Id: I40713b0ded42063b786dc21247e854224b9d2fe2 Closes-Bug: #1561599 --- openstackclient/identity/v3/user.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'openstackclient/identity/v3/user.py') diff --git a/openstackclient/identity/v3/user.py b/openstackclient/identity/v3/user.py index b0c80c14..dd5af06a 100644 --- a/openstackclient/identity/v3/user.py +++ b/openstackclient/identity/v3/user.py @@ -444,14 +444,16 @@ class ShowUser(command.ShowOne): def take_action(self, parsed_args): identity_client = self.app.client_manager.identity + user_str = common._get_token_resource(identity_client, 'user', + parsed_args.user) if parsed_args.domain: domain = common.find_domain(identity_client, parsed_args.domain) user = utils.find_resource(identity_client.users, - parsed_args.user, + user_str, domain_id=domain.id) else: user = utils.find_resource(identity_client.users, - parsed_args.user) + user_str) user._info.pop('links') return zip(*sorted(six.iteritems(user._info))) -- cgit v1.2.1