1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

ec2_vol: wait for delete_on_termination to be set to the correct value. Fixes #22534. (#28848)

wait for delete_on_termination to be set to the correct value, it can take some time to correctly reflect the setting sent in the API call.
This commit is contained in:
Sloane Hertel 2017-09-11 16:52:06 -04:00 committed by Ryan Brown
parent ff13d58c14
commit 942b6fb9bc

View file

@ -621,6 +621,15 @@ def main():
# Add device, volume_id and volume_type parameters separately to maintain backward compatibility # Add device, volume_id and volume_type parameters separately to maintain backward compatibility
volume_info = get_volume_info(volume, state) volume_info = get_volume_info(volume, state)
# deleteOnTermination is not correctly reflected on attachment
if module.params.get('delete_on_termination'):
for attempt in range(0, 8):
if volume_info['attachment_set'].get('deleteOnTermination') == 'true':
break
time.sleep(5)
volume = ec2.get_all_volumes(volume_ids=volume.id)[0]
volume_info = get_volume_info(volume, state)
module.exit_json(changed=changed, volume=volume_info, device=volume_info['attachment_set']['device'], module.exit_json(changed=changed, volume=volume_info, device=volume_info['attachment_set']['device'],
volume_id=volume_info['id'], volume_type=volume_info['type']) volume_id=volume_info['id'], volume_type=volume_info['type'])
elif state == 'absent': elif state == 'absent':