diff options
| author | Steve Martinelli <stevemar@ca.ibm.com> | 2015-07-10 18:01:55 +0000 |
|---|---|---|
| committer | lin-hua-cheng <os.lcheng@gmail.com> | 2015-07-20 20:12:50 -0700 |
| commit | 921361b3ae538b8f4a9a4725623ccc5bb7a0d48d (patch) | |
| tree | e2fc65bfbae327f518d22b833126e9975d9f844e /openstackclient | |
| parent | 37c83e6231dcfb2f0f4d28f13f78ac2dc170b768 (diff) | |
| download | python-openstackclient-921361b3ae538b8f4a9a4725623ccc5bb7a0d48d.tar.gz | |
Make trustee/trustor/project searchable by ID
In the previous implementation, we were always including the domain
argument, which caused a lookup by name for trustee/trustor and
project. By excluding it when not necessary, we do a search by
ID in find_resources.
Change-Id: Id756aeab522b5dccb2dc6b31d137a28514b0fdf6
Closes-Bug: 1473298
Diffstat (limited to 'openstackclient')
| -rw-r--r-- | openstackclient/identity/v3/trust.py | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/openstackclient/identity/v3/trust.py b/openstackclient/identity/v3/trust.py index c8e5c4c7..2f0f804a 100644 --- a/openstackclient/identity/v3/trust.py +++ b/openstackclient/identity/v3/trust.py @@ -88,35 +88,20 @@ class CreateTrust(show.ShowOne): self.log.debug('take_action(%s)' % parsed_args) identity_client = self.app.client_manager.identity - project_domain = None - if parsed_args.project_domain: - project_domain = common.find_domain(identity_client, - parsed_args.project_domain).id - - trustor_domain = None - if parsed_args.trustor_domain: - trustor_domain = common.find_domain(identity_client, - parsed_args.trustor_domain).id - - trustee_domain = None - if parsed_args.trustee_domain: - trustee_domain = common.find_domain(identity_client, - parsed_args.trustee_domain).id - # NOTE(stevemar): Find the two users, project and roles that # are necessary for making a trust usable, the API dictates that # trustee, project and role are optional, but that makes the trust # pointless, and trusts are immutable, so let's enforce it at the # client level. - trustor_id = utils.find_resource(identity_client.users, - parsed_args.trustor, - domain_id=trustor_domain).id - trustee_id = utils.find_resource(identity_client.users, - parsed_args.trustee, - domain_id=trustee_domain).id - project_id = utils.find_resource(identity_client.projects, + trustor_id = common.find_user(identity_client, + parsed_args.trustor, + parsed_args.trustor_domain).id + trustee_id = common.find_user(identity_client, + parsed_args.trustee, + parsed_args.trustee_domain).id + project_id = common.find_project(identity_client, parsed_args.project, - domain_id=project_domain).id + parsed_args.project_domain).id role_names = [] for role in parsed_args.role: |
