ec2_vol_facts: set filters to default value (#51589)

Fixes: #51554

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/53820/head
Abhijeet Kasurde 6 years ago committed by GitHub
parent c459f040da
commit c20722474a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -65,9 +65,8 @@ except ImportError:
pass # caught by imported HAS_BOTO3
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.ec2 import connect_to_aws, ec2_argument_spec, get_aws_connection_info, boto3_conn, HAS_BOTO3, boto3_tag_list_to_ansible_dict
from ansible.module_utils.ec2 import ec2_argument_spec, get_aws_connection_info, boto3_conn, HAS_BOTO3, boto3_tag_list_to_ansible_dict
from ansible.module_utils.ec2 import ansible_dict_to_boto3_filter_list, camel_dict_to_snake_dict
from ansible.module_utils._text import to_native
def get_volume_info(volume, region):
@ -114,7 +113,6 @@ def list_ec2_volumes(connection, module, region):
try:
all_volumes = describe_volumes_with_backoff(connection, ansible_dict_to_boto3_filter_list(sanitized_filters))
except ClientError as e:
module.fail_json(msg=e.response, exception=traceback.format_exc())
@ -128,7 +126,7 @@ def main():
argument_spec = ec2_argument_spec()
argument_spec.update(
dict(
filters=dict(default=None, type='dict')
filters=dict(default={}, type='dict')
)
)

@ -49,6 +49,17 @@
delete_on_termination: yes
register: volume
- name: Gather volume info without any filters
ec2_vol_facts:
<<: *aws_connection_info
register: volume_facts_wo_filters
check_mode: no
- name: Check if facts are returned without filters
assert:
that:
- "volume_facts_wo_filters.volumes is defined"
- name: Gather volume info
ec2_vol_facts:
<<: *aws_connection_info

Loading…
Cancel
Save