mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix ec2_snapshot_facts traceback if a snapshot has been deleted (#32217)
This commit is contained in:
parent
53ade280a3
commit
cabd7f078b
1 changed files with 6 additions and 1 deletions
|
@ -193,7 +193,12 @@ def list_ec2_snapshots(connection, module):
|
|||
try:
|
||||
snapshots = connection.describe_snapshots(SnapshotIds=snapshot_ids, OwnerIds=owner_ids, RestorableByUserIds=restorable_by_user_ids, Filters=filters)
|
||||
except ClientError as e:
|
||||
module.fail_json(msg=e.message)
|
||||
if e.response['Error']['Code'] == "InvalidSnapshot.NotFound":
|
||||
if len(snapshot_ids) > 1:
|
||||
module.warn("Some of your snapshots may exist, but %s" % str(e))
|
||||
snapshots = {'Snapshots': []}
|
||||
else:
|
||||
module.fail_json(msg="Failed to describe snapshots: %s" % str(e))
|
||||
|
||||
# Turn the boto3 result in to ansible_friendly_snaked_names
|
||||
snaked_snapshots = []
|
||||
|
|
Loading…
Reference in a new issue