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:
Carsten Koester 2018-12-10 12:41:22 +01:00 committed by John R Barker
commit e25dac946f
2 changed files with 11 additions and 6 deletions

View file

@ -134,11 +134,12 @@ def openstack_cloud_from_module(module, min_version='0.12.0'):
" excluded.")
for param in (
'auth', 'region_name', 'verify',
'cacert', 'key', 'api_timeout', 'interface'):
'cacert', 'key', 'api_timeout', 'auth_type'):
if module.params[param] is not None:
module.fail_json(msg=fail_message.format(param=param))
if module.params['auth_type'] != 'password':
module.fail_json(msg=fail_message.format(param='auth_type'))
# For 'interface' parameter, fail if we receive a non-default value
if module.params['interface'] != 'public':
module.fail_json(msg=fail_message.format(param='interface'))
return sdk, sdk.connect(**cloud_config)
else:
return sdk, sdk.connect(