1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Port openstack module_utils changes to v2 branch

This commit is contained in:
Monty Taylor 2015-02-13 10:41:58 -05:00
parent 4e4bdaad8d
commit d06a277b50

View file

@ -30,6 +30,9 @@ import os
def openstack_argument_spec(): def openstack_argument_spec():
# DEPRECATED: This argument spec is only used for the deprecated old
# OpenStack modules. It turns out that modern OpenStack auth is WAY
# more complex than this.
# Consume standard OpenStack environment variables. # Consume standard OpenStack environment variables.
# This is mainly only useful for ad-hoc command line operation as # This is mainly only useful for ad-hoc command line operation as
# in playbooks one would assume variables would be used appropriately # in playbooks one would assume variables would be used appropriately
@ -67,3 +70,35 @@ def openstack_find_nova_addresses(addresses, ext_tag, key_name=None):
ret.append(interface_spec['addr']) ret.append(interface_spec['addr'])
return ret return ret
def openstack_full_argument_spec(**kwargs):
spec = dict(
cloud=dict(default=None),
auth_plugin=dict(default=None),
auth=dict(default=None),
region_name=dict(default=None),
availability_zone=dict(default=None),
state=dict(default='present', choices=['absent', 'present']),
wait=dict(default=True, type='bool'),
timeout=dict(default=180, type='int'),
endpoint_type=dict(
default='publicURL', choices=['publicURL', 'internalURL']
)
)
spec.update(kwargs)
return spec
def openstack_module_kwargs(**kwargs):
ret = dict(
required_one_of=[
['cloud', 'auth'],
],
)
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