From 3ca96ef93cda1a3f186febc0e241e2d4adb682eb Mon Sep 17 00:00:00 2001 From: Juan Antonio Osorio Robles Date: Wed, 6 May 2015 22:46:32 +0300 Subject: Enable specifing domains in "role add" If users, projects or groups are provided by name, there is a possibility of the existence other users/projects/groups with the same name in other domain. Even though this is not a problem if the actual ID is given instead of a name; this is mostly a usability enhancement. So, three options were added, one for specifying the domain where the user belongs, another one to specify the project's domain, and finally one to specify the group's domain. Change-Id: Iab04b0e04fa75ea5aa3723b8ea42a45f58a6cdb2 Closes-Bug: #1421328 --- openstackclient/identity/common.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'openstackclient/identity/common.py') diff --git a/openstackclient/identity/common.py b/openstackclient/identity/common.py index 2cc68c8d..a6e674c0 100644 --- a/openstackclient/identity/common.py +++ b/openstackclient/identity/common.py @@ -48,23 +48,23 @@ def find_domain(identity_client, name_or_id): domains.Domain) -def find_group(identity_client, name_or_id): +def find_group(identity_client, name_or_id, domain_id=None): return _find_identity_resource(identity_client.groups, name_or_id, - groups.Group) + groups.Group, domain_id=domain_id) -def find_project(identity_client, name_or_id): +def find_project(identity_client, name_or_id, domain_id=None): return _find_identity_resource(identity_client.projects, name_or_id, - projects.Project) + projects.Project, domain_id=domain_id) -def find_user(identity_client, name_or_id): +def find_user(identity_client, name_or_id, domain_id=None): return _find_identity_resource(identity_client.users, name_or_id, - users.User) + users.User, domain_id=domain_id) def _find_identity_resource(identity_client_manager, name_or_id, - resource_type): + resource_type, **kwargs): """Find a specific identity resource. Using keystoneclient's manager, attempt to find a specific resource by its @@ -92,7 +92,7 @@ def _find_identity_resource(identity_client_manager, name_or_id, try: identity_resource = utils.find_resource(identity_client_manager, - name_or_id) + name_or_id, **kwargs) if identity_resource is not None: return identity_resource except identity_exc.Forbidden: -- cgit v1.2.1