Remove unneeded required_one_of for openstack

We're being too strict - there is a third possibility, which is that a
user will have defined the OS_* environment variables and expect them to
pass through.

Conflicts:
	lib/ansible/module_utils/openstack.py
	lib/ansible/utils/module_docs_fragments/openstack.py
	v2/ansible/module_utils/openstack.py
This commit is contained in:
Monty Taylor 2015-05-11 08:06:21 -04:00 committed by Toshio Kuratomi
parent 8286253c81
commit 7a76d4e03b
3 changed files with 34 additions and 4 deletions

View file

@ -91,9 +91,6 @@ def openstack_full_argument_spec(**kwargs):
def openstack_module_kwargs(**kwargs):
ret = dict(
required_one_of=[
['cloud', 'auth'],
],
mutually_exclusive=[
['auth', 'auth_token'],
['auth_plugin', 'auth_token'],

View file

@ -32,7 +32,8 @@ options:
I(auth_url), I(username), I(password), I(project_name) and any
information about domains if the cloud supports them. For other plugins,
this param will need to contain whatever parameters that auth plugin
requires. This parameter is not needed if a named cloud is provided.
requires. This parameter is not needed if a named cloud is provided or
OpenStack OS_* environment variables are present.
required: false
auth_plugin:
description:

View file

@ -67,3 +67,35 @@ def openstack_find_nova_addresses(addresses, ext_tag, key_name=None):
ret.append(interface_spec['addr'])
return ret
def openstack_full_argument_spec(**kwargs):
spec = dict(
cloud=dict(default=None),
auth_type=dict(default=None),
auth=dict(default=None),
region_name=dict(default=None),
availability_zone=dict(default=None),
verify=dict(default=True, aliases=['validate_certs']),
cacert=dict(default=None),
cert=dict(default=None),
key=dict(default=None),
wait=dict(default=True, type='bool'),
timeout=dict(default=180, type='int'),
api_timeout=dict(default=None, type='int'),
endpoint_type=dict(
default='public', choices=['public', 'internal', 'admin']
)
)
spec.update(kwargs)
return spec
def openstack_module_kwargs(**kwargs):
ret = {}
for key in ('mutually_exclusive', 'required_together', 'required_one_of'):
if key in kwargs:
if key in ret:
ret[key].extend(kwargs[key])
else:
ret[key] = kwargs[key]
return ret