ec2_vol_facts: set filters to default value (#51589)
Fixes: #51554 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
c459f040da
commit
c20722474a
2 changed files with 13 additions and 4 deletions
lib/ansible/modules/cloud/amazon
test/integration/targets/ec2_vol_facts/tasks
|
@ -65,9 +65,8 @@ except ImportError:
|
||||||
pass # caught by imported HAS_BOTO3
|
pass # caught by imported HAS_BOTO3
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
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.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):
|
def get_volume_info(volume, region):
|
||||||
|
@ -114,7 +113,6 @@ def list_ec2_volumes(connection, module, region):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
all_volumes = describe_volumes_with_backoff(connection, ansible_dict_to_boto3_filter_list(sanitized_filters))
|
all_volumes = describe_volumes_with_backoff(connection, ansible_dict_to_boto3_filter_list(sanitized_filters))
|
||||||
|
|
||||||
except ClientError as e:
|
except ClientError as e:
|
||||||
module.fail_json(msg=e.response, exception=traceback.format_exc())
|
module.fail_json(msg=e.response, exception=traceback.format_exc())
|
||||||
|
|
||||||
|
@ -128,7 +126,7 @@ def main():
|
||||||
argument_spec = ec2_argument_spec()
|
argument_spec = ec2_argument_spec()
|
||||||
argument_spec.update(
|
argument_spec.update(
|
||||||
dict(
|
dict(
|
||||||
filters=dict(default=None, type='dict')
|
filters=dict(default={}, type='dict')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,17 @@
|
||||||
delete_on_termination: yes
|
delete_on_termination: yes
|
||||||
register: volume
|
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
|
- name: Gather volume info
|
||||||
ec2_vol_facts:
|
ec2_vol_facts:
|
||||||
<<: *aws_connection_info
|
<<: *aws_connection_info
|
||||||
|
|
Loading…
Add table
Reference in a new issue