Skip to content

Commit 4d9d2db

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Make trustee/trustor/project searchable by ID"
2 parents 4c368d1 + 921361b commit 4d9d2db

1 file changed

Lines changed: 8 additions & 23 deletions

File tree

openstackclient/identity/v3/trust.py

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -88,35 +88,20 @@ def take_action(self, parsed_args):
8888
self.log.debug('take_action(%s)' % parsed_args)
8989
identity_client = self.app.client_manager.identity
9090

91-
project_domain = None
92-
if parsed_args.project_domain:
93-
project_domain = common.find_domain(identity_client,
94-
parsed_args.project_domain).id
95-
96-
trustor_domain = None
97-
if parsed_args.trustor_domain:
98-
trustor_domain = common.find_domain(identity_client,
99-
parsed_args.trustor_domain).id
100-
101-
trustee_domain = None
102-
if parsed_args.trustee_domain:
103-
trustee_domain = common.find_domain(identity_client,
104-
parsed_args.trustee_domain).id
105-
10691
# NOTE(stevemar): Find the two users, project and roles that
10792
# are necessary for making a trust usable, the API dictates that
10893
# trustee, project and role are optional, but that makes the trust
10994
# pointless, and trusts are immutable, so let's enforce it at the
11095
# client level.
111-
trustor_id = utils.find_resource(identity_client.users,
112-
parsed_args.trustor,
113-
domain_id=trustor_domain).id
114-
trustee_id = utils.find_resource(identity_client.users,
115-
parsed_args.trustee,
116-
domain_id=trustee_domain).id
117-
project_id = utils.find_resource(identity_client.projects,
96+
trustor_id = common.find_user(identity_client,
97+
parsed_args.trustor,
98+
parsed_args.trustor_domain).id
99+
trustee_id = common.find_user(identity_client,
100+
parsed_args.trustee,
101+
parsed_args.trustee_domain).id
102+
project_id = common.find_project(identity_client,
118103
parsed_args.project,
119-
domain_id=project_domain).id
104+
parsed_args.project_domain).id
120105

121106
role_names = []
122107
for role in parsed_args.role:

0 commit comments

Comments
 (0)