Ensure os_project checks the right domain (#2519)

This commit is contained in:
Alvaro Aleman 2016-07-25 20:05:58 +02:00 committed by Matt Clay
parent ec0fff49ea
commit 54d40fe557

View file

@ -111,7 +111,7 @@ def _needs_update(module, project):
keys = ('description', 'enabled') keys = ('description', 'enabled')
for key in keys: for key in keys:
if module.params[key] is not None and module.params[key] != project.get(key): if module.params[key] is not None and module.params[key] != project.get(key):
return True return True
return False return False
@ -176,9 +176,13 @@ def main():
except: except:
# Ok, let's hope the user is non-admin and passing a sane id # Ok, let's hope the user is non-admin and passing a sane id
pass pass
cloud = shade.openstack_cloud(**module.params) cloud = shade.openstack_cloud(**module.params)
project = cloud.get_project(name)
if domain:
project = cloud.get_project(name, domain_id=domain)
else:
project = cloud.get_project(name)
if module.check_mode: if module.check_mode:
module.exit_json(changed=_system_state_change(module, project)) module.exit_json(changed=_system_state_change(module, project))