Fix the way we call find_resource when only using ID

Change-Id: I6fb08edd5499767863e0e67f363bcd9fff3aea60
Closes-Bug: 1475127
This commit is contained in:
Steve Martinelli 2015-07-16 01:59:08 -04:00
parent 1af89f757c
commit 37c83e6231

View File

@ -57,20 +57,32 @@ def find_domain(identity_client, name_or_id):
def find_group(identity_client, name_or_id, domain_name_or_id=None):
domain_id = _get_domain_id_if_requested(identity_client, domain_name_or_id)
return _find_identity_resource(identity_client.groups, name_or_id,
groups.Group, domain_id=domain_id)
if not domain_id:
return _find_identity_resource(identity_client.groups, name_or_id,
groups.Group)
else:
return _find_identity_resource(identity_client.groups, name_or_id,
groups.Group, domain_id=domain_id)
def find_project(identity_client, name_or_id, domain_name_or_id=None):
domain_id = _get_domain_id_if_requested(identity_client, domain_name_or_id)
return _find_identity_resource(identity_client.projects, name_or_id,
projects.Project, domain_id=domain_id)
if not domain_id:
return _find_identity_resource(identity_client.projects, name_or_id,
projects.Project)
else:
return _find_identity_resource(identity_client.projects, name_or_id,
projects.Project, domain_id=domain_id)
def find_user(identity_client, name_or_id, domain_name_or_id=None):
domain_id = _get_domain_id_if_requested(identity_client, domain_name_or_id)
return _find_identity_resource(identity_client.users, name_or_id,
users.User, domain_id=domain_id)
if not domain_id:
return _find_identity_resource(identity_client.users, name_or_id,
users.User)
else:
return _find_identity_resource(identity_client.users, name_or_id,
users.User, domain_id=domain_id)
def _find_identity_resource(identity_client_manager, name_or_id,