Fix parameters where type is assumed.

A change is coming to Ansible where module params will default to str.
Many of our modules were taking advantage of this by not being explicit
about the type, so they will break when that change merges. This hopefully
catches those cases.
This commit is contained in:
David Shrewsbury 2016-02-12 12:30:52 -05:00
parent 0d1bf50ca1
commit f71542ccf2
7 changed files with 12 additions and 12 deletions

View file

@ -53,7 +53,7 @@ EXAMPLES = '''
def main(): def main():
module = AnsibleModule(argument_spec=dict( module = AnsibleModule(argument_spec=dict(
clouds=dict(required=False, default=[]), clouds=dict(required=False, type='list', default=[]),
)) ))
p = module.params p = module.params

View file

@ -131,7 +131,7 @@ def main():
filename = dict(default=None), filename = dict(default=None),
ramdisk = dict(default=None), ramdisk = dict(default=None),
kernel = dict(default=None), kernel = dict(default=None),
properties = dict(default={}), properties = dict(type='dict', default={}),
state = dict(default='present', choices=['absent', 'present']), state = dict(default='present', choices=['absent', 'present']),
) )
module_kwargs = openstack_module_kwargs() module_kwargs = openstack_module_kwargs()

View file

@ -237,7 +237,7 @@ def main():
power=dict(required=False, default='present'), power=dict(required=False, default='present'),
deploy=dict(required=False, default=True), deploy=dict(required=False, default=True),
wait=dict(type='bool', required=False, default=False), wait=dict(type='bool', required=False, default=False),
timeout=dict(required=False, default=1800), timeout=dict(required=False, type='int', default=1800),
) )
module_kwargs = openstack_module_kwargs() module_kwargs = openstack_module_kwargs()
module = AnsibleModule(argument_spec, **module_kwargs) module = AnsibleModule(argument_spec, **module_kwargs)

View file

@ -117,7 +117,7 @@ def main():
argument_spec = openstack_full_argument_spec( argument_spec = openstack_full_argument_spec(
name=dict(required=False, default=None), name=dict(required=False, default=None),
filters=dict(required=False, default=None) filters=dict(required=False, type='dict', default=None)
) )
module = AnsibleModule(argument_spec) module = AnsibleModule(argument_spec)

View file

@ -305,13 +305,13 @@ def main():
argument_spec = openstack_full_argument_spec( argument_spec = openstack_full_argument_spec(
network=dict(required=False), network=dict(required=False),
name=dict(required=False), name=dict(required=False),
fixed_ips=dict(default=None), fixed_ips=dict(type='list', default=None),
admin_state_up=dict(default=None), admin_state_up=dict(type='bool', default=None),
mac_address=dict(default=None), mac_address=dict(default=None),
security_groups=dict(default=None, type='list'), security_groups=dict(default=None, type='list'),
no_security_groups=dict(default=False, type='bool'), no_security_groups=dict(default=False, type='bool'),
allowed_address_pairs=dict(default=None), allowed_address_pairs=dict(type='dict', default=None),
extra_dhcp_opt=dict(default=None), extra_dhcp_opt=dict(type='dict', default=None),
device_owner=dict(default=None), device_owner=dict(default=None),
device_id=dict(default=None), device_id=dict(default=None),
state=dict(default='present', choices=['absent', 'present']), state=dict(default='present', choices=['absent', 'present']),

View file

@ -110,7 +110,7 @@ options:
default: None default: None
floating_ip_pools: floating_ip_pools:
description: description:
- list of floating IP pools from which to choose a floating IP - Name of floating IP pool from which to choose a floating IP
required: false required: false
default: None default: None
meta: meta:
@ -544,11 +544,11 @@ def main():
security_groups = dict(default=['default'], type='list'), security_groups = dict(default=['default'], type='list'),
network = dict(default=None), network = dict(default=None),
nics = dict(default=[], type='list'), nics = dict(default=[], type='list'),
meta = dict(default=None), meta = dict(default=None, type='raw'),
userdata = dict(default=None, aliases=['user_data']), userdata = dict(default=None, aliases=['user_data']),
config_drive = dict(default=False, type='bool'), config_drive = dict(default=False, type='bool'),
auto_ip = dict(default=True, type='bool', aliases=['auto_floating_ip', 'public_ip']), auto_ip = dict(default=True, type='bool', aliases=['auto_floating_ip', 'public_ip']),
floating_ips = dict(default=None), floating_ips = dict(default=None, type='list'),
floating_ip_pools = dict(default=None), floating_ip_pools = dict(default=None),
volume_size = dict(default=False, type='int'), volume_size = dict(default=False, type='int'),
boot_from_volume = dict(default=False, type='bool'), boot_from_volume = dict(default=False, type='bool'),

View file

@ -130,7 +130,7 @@ def main():
argument_spec = openstack_full_argument_spec( argument_spec = openstack_full_argument_spec(
name=dict(required=False, default=None), name=dict(required=False, default=None),
filters=dict(required=False, default=None) filters=dict(required=False, type='dict', default=None)
) )
module = AnsibleModule(argument_spec) module = AnsibleModule(argument_spec)