diff --git a/lib/ansible/modules/cloud/amazon/ec2_snapshot_facts.py b/lib/ansible/modules/cloud/amazon/ec2_snapshot_facts.py index 1b150890845..a4c8e8a66f1 100644 --- a/lib/ansible/modules/cloud/amazon/ec2_snapshot_facts.py +++ b/lib/ansible/modules/cloud/amazon/ec2_snapshot_facts.py @@ -185,8 +185,8 @@ from ansible.module_utils.ec2 import (ansible_dict_to_boto3_filter_list, def list_ec2_snapshots(connection, module): snapshot_ids = module.params.get("snapshot_ids") - owner_ids = map(str, module.params.get("owner_ids")) - restorable_by_user_ids = module.params.get("restorable_by_user_ids") + owner_ids = [str(owner_id) for owner_id in module.params.get("owner_ids")] + restorable_by_user_ids = [str(user_id) for user_id in module.params.get("restorable_by_user_ids")] filters = ansible_dict_to_boto3_filter_list(module.params.get("filters")) try: diff --git a/test/integration/targets/ec2_ami/tasks/main.yml b/test/integration/targets/ec2_ami/tasks/main.yml index b7a665e0138..8e201fbc5fa 100644 --- a/test/integration/targets/ec2_ami/tasks/main.yml +++ b/test/integration/targets/ec2_ami/tasks/main.yml @@ -346,21 +346,20 @@ - "result.changed" - "'image_id' not in result" -# FIXME: in ec2_snapshot_facts OwnerIds is cast to a map, causing traceback (needs to be a list or tuple) -# - name: ensure the snapshot still exists -# ec2_snapshot_facts: -# snapshot_ids: -# - '{{ ec2_ami_snapshot }}' -# ec2_region: '{{ec2_region}}' -# ec2_access_key: '{{ec2_access_key}}' -# ec2_secret_key: '{{ec2_secret_key}}' -# security_token: '{{security_token}}' -# register: snapshot_result + - name: ensure the snapshot still exists + ec2_snapshot_facts: + snapshot_ids: + - '{{ ec2_ami_snapshot }}' + ec2_region: '{{ec2_region}}' + ec2_access_key: '{{ec2_access_key}}' + ec2_secret_key: '{{ec2_secret_key}}' + security_token: '{{security_token}}' + register: snapshot_result -# - name: assert the snapshot wasn't deleted -# assert: -# that: -# - "snapshot_result.snapshots[0].snapshot_id == ec2_ami_snapshot" + - name: assert the snapshot wasn't deleted + assert: + that: + - "snapshot_result.snapshots[0].snapshot_id == ec2_ami_snapshot" - name: delete ami for a second time ec2_ami: