From d7568a50e2fdec827e4efff471decbc2cb845ac3 Mon Sep 17 00:00:00 2001 From: David Shrewsbury Date: Fri, 12 Feb 2016 12:30:52 -0500 Subject: [PATCH] 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. --- lib/ansible/modules/cloud/openstack/os_client_config.py | 2 +- lib/ansible/modules/cloud/openstack/os_image.py | 2 +- lib/ansible/modules/cloud/openstack/os_ironic_node.py | 2 +- lib/ansible/modules/cloud/openstack/os_networks_facts.py | 2 +- lib/ansible/modules/cloud/openstack/os_port.py | 8 ++++---- lib/ansible/modules/cloud/openstack/os_server.py | 6 +++--- lib/ansible/modules/cloud/openstack/os_subnets_facts.py | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/ansible/modules/cloud/openstack/os_client_config.py b/lib/ansible/modules/cloud/openstack/os_client_config.py index 67c58dfd6c..252f085c53 100644 --- a/lib/ansible/modules/cloud/openstack/os_client_config.py +++ b/lib/ansible/modules/cloud/openstack/os_client_config.py @@ -53,7 +53,7 @@ EXAMPLES = ''' def main(): module = AnsibleModule(argument_spec=dict( - clouds=dict(required=False, default=[]), + clouds=dict(required=False, type='list', default=[]), )) p = module.params diff --git a/lib/ansible/modules/cloud/openstack/os_image.py b/lib/ansible/modules/cloud/openstack/os_image.py index 565bd868c3..06695a268f 100644 --- a/lib/ansible/modules/cloud/openstack/os_image.py +++ b/lib/ansible/modules/cloud/openstack/os_image.py @@ -131,7 +131,7 @@ def main(): filename = dict(default=None), ramdisk = dict(default=None), kernel = dict(default=None), - properties = dict(default={}), + properties = dict(type='dict', default={}), state = dict(default='present', choices=['absent', 'present']), ) module_kwargs = openstack_module_kwargs() diff --git a/lib/ansible/modules/cloud/openstack/os_ironic_node.py b/lib/ansible/modules/cloud/openstack/os_ironic_node.py index a10c028d06..a18b992abc 100644 --- a/lib/ansible/modules/cloud/openstack/os_ironic_node.py +++ b/lib/ansible/modules/cloud/openstack/os_ironic_node.py @@ -234,7 +234,7 @@ def main(): power=dict(required=False, default='present'), deploy=dict(required=False, default=True), 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 = AnsibleModule(argument_spec, **module_kwargs) diff --git a/lib/ansible/modules/cloud/openstack/os_networks_facts.py b/lib/ansible/modules/cloud/openstack/os_networks_facts.py index 8b7592beb6..0cc868b547 100644 --- a/lib/ansible/modules/cloud/openstack/os_networks_facts.py +++ b/lib/ansible/modules/cloud/openstack/os_networks_facts.py @@ -117,7 +117,7 @@ def main(): argument_spec = openstack_full_argument_spec( name=dict(required=False, default=None), - filters=dict(required=False, default=None) + filters=dict(required=False, type='dict', default=None) ) module = AnsibleModule(argument_spec) diff --git a/lib/ansible/modules/cloud/openstack/os_port.py b/lib/ansible/modules/cloud/openstack/os_port.py index 67bcac7b32..69d13f3d0e 100644 --- a/lib/ansible/modules/cloud/openstack/os_port.py +++ b/lib/ansible/modules/cloud/openstack/os_port.py @@ -305,13 +305,13 @@ def main(): argument_spec = openstack_full_argument_spec( network=dict(required=False), name=dict(required=False), - fixed_ips=dict(default=None), - admin_state_up=dict(default=None), + fixed_ips=dict(type='list', default=None), + admin_state_up=dict(type='bool', default=None), mac_address=dict(default=None), security_groups=dict(default=None, type='list'), no_security_groups=dict(default=False, type='bool'), - allowed_address_pairs=dict(default=None), - extra_dhcp_opt=dict(default=None), + allowed_address_pairs=dict(type='dict', default=None), + extra_dhcp_opt=dict(type='dict', default=None), device_owner=dict(default=None), device_id=dict(default=None), state=dict(default='present', choices=['absent', 'present']), diff --git a/lib/ansible/modules/cloud/openstack/os_server.py b/lib/ansible/modules/cloud/openstack/os_server.py index eefdeb5d80..92c2ae0e2b 100644 --- a/lib/ansible/modules/cloud/openstack/os_server.py +++ b/lib/ansible/modules/cloud/openstack/os_server.py @@ -112,7 +112,7 @@ options: default: None floating_ip_pools: 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 default: None meta: @@ -544,11 +544,11 @@ def main(): security_groups = dict(default=['default'], type='list'), network = dict(default=None), nics = dict(default=[], type='list'), - meta = dict(default=None), + meta = dict(default=None, type='raw'), userdata = dict(default=None, aliases=['user_data']), config_drive = dict(default=False, type='bool'), 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), volume_size = dict(default=False, type='int'), boot_from_volume = dict(default=False, type='bool'), diff --git a/lib/ansible/modules/cloud/openstack/os_subnets_facts.py b/lib/ansible/modules/cloud/openstack/os_subnets_facts.py index 676daefea7..8d853de76d 100644 --- a/lib/ansible/modules/cloud/openstack/os_subnets_facts.py +++ b/lib/ansible/modules/cloud/openstack/os_subnets_facts.py @@ -130,7 +130,7 @@ def main(): argument_spec = openstack_full_argument_spec( name=dict(required=False, default=None), - filters=dict(required=False, default=None) + filters=dict(required=False, type='dict', default=None) ) module = AnsibleModule(argument_spec)