mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
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:
parent
ff13d58c14
commit
942b6fb9bc
1 changed files with 9 additions and 0 deletions
|
@ -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':
|
||||||
|
|
Loading…
Reference in a new issue