Search project in domain when it's defined (#59876)

Since there might be several projects with the same name in different
domains, it's required to define domain_id during project search.
Otherwise openstacksdk will raise "Multiple matches found" error
This commit is contained in:
Dmitriy Rabotyagov 2019-08-12 14:05:36 +03:00 committed by ansibot
parent a3407682ed
commit 8d3fa2251e

View file

@ -172,8 +172,8 @@ def _get_domain_id(cloud, domain):
return domain_id
def _get_default_project_id(cloud, default_project, module):
project = cloud.get_project(default_project)
def _get_default_project_id(cloud, default_project, domain_id, module):
project = cloud.get_project(default_project, domain_id=domain_id)
if not project:
module.fail_json(msg='Default project %s is not valid' % default_project)
@ -224,7 +224,7 @@ def main():
module.fail_json(msg=msg)
default_project_id = None
if default_project:
default_project_id = _get_default_project_id(cloud, default_project, module)
default_project_id = _get_default_project_id(cloud, default_project, domain_id, module)
if user is None:
if description is not None: