mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
openstack: fix parameter handling when cloud provided as dict (#42899)
* openstack: fix parameter handling when cloud provided as dict If a cloud is provided as dictionary: * Do not assert that 'interface' parameter is None. Instead, assert that it is 'public'. * Assert that 'auth_type' parameter is not set. Fixes #42858 * os_user: Include domain parameter in user lookup If a "domain" parameter is provided, use it in looking up whether the user already exists. Fixes #42901 * os_user: Include domain parameter in user deletion If a "domain" parameter is provided, use it in deleting the user also. Fixes #42901
This commit is contained in:
parent
60a3b0bcf0
commit
e25dac946f
2 changed files with 11 additions and 6 deletions
|
@ -210,11 +210,12 @@ def main():
|
|||
|
||||
sdk, cloud = openstack_cloud_from_module(module)
|
||||
try:
|
||||
user = cloud.get_user(name)
|
||||
|
||||
domain_id = None
|
||||
if domain:
|
||||
domain_id = _get_domain_id(cloud, domain)
|
||||
user = cloud.get_user(name, domain_id=domain_id)
|
||||
else:
|
||||
user = cloud.get_user(name)
|
||||
|
||||
if state == 'present':
|
||||
if update_password in ('always', 'on_create'):
|
||||
|
@ -280,7 +281,10 @@ def main():
|
|||
if user is None:
|
||||
changed = False
|
||||
else:
|
||||
cloud.delete_user(user['id'])
|
||||
if domain:
|
||||
cloud.delete_user(user['id'], domain_id=domain_id)
|
||||
else:
|
||||
cloud.delete_user(user['id'])
|
||||
changed = True
|
||||
module.exit_json(changed=changed)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue