Search project in domain when it's defined

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

(cherry picked from commit 33ab7ca162)
pull/60753/head
Dmitriy Rabotyagov 7 years ago committed by Toshio Kuratomi
parent 6468dcc4be
commit 9218856617

@ -0,0 +1,2 @@
bugfixes:
- os_user - when domain is provided, default_project will be taken from this domain.

@ -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:

Loading…
Cancel
Save