ec2_ami: Properly delete snapshots (#39606)
This commit is contained in:
parent
afdc2364f2
commit
910bc892c6
2 changed files with 2 additions and 1 deletions
|
@ -496,7 +496,7 @@ def deregister_image(module, connection):
|
||||||
snapshots = []
|
snapshots = []
|
||||||
if 'BlockDeviceMappings' in image:
|
if 'BlockDeviceMappings' in image:
|
||||||
for mapping in image.get('BlockDeviceMappings'):
|
for mapping in image.get('BlockDeviceMappings'):
|
||||||
snapshot_id = mapping.get('SnapshotId')
|
snapshot_id = mapping.get('Ebs', {}).get('SnapshotId')
|
||||||
if snapshot_id is not None:
|
if snapshot_id is not None:
|
||||||
snapshots.append(snapshot_id)
|
snapshots.append(snapshot_id)
|
||||||
|
|
||||||
|
|
|
@ -158,6 +158,7 @@
|
||||||
that:
|
that:
|
||||||
- "result.changed"
|
- "result.changed"
|
||||||
- "'image_id' not in result"
|
- "'image_id' not in result"
|
||||||
|
- "result.snapshots_deleted"
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue