From 1a1c7a956bc39b1d919412e2eac10186b0802a30 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Thu, 7 Nov 2019 13:24:19 +0700 Subject: [PATCH] Wait for volume resize to complete --- checkvolumesize | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/checkvolumesize b/checkvolumesize index 98286c3..74ba72c 100755 --- a/checkvolumesize +++ b/checkvolumesize @@ -105,6 +105,16 @@ main () { action_json=$(digital_ocean_api "volumes/2cbebc6a-ff42-11e9-a238-0a58ac14a19d/actions" '{"type":"resize","size_gigabytes":'$new_volume_size'}') action_id=$(echo $action_json | jq -r '.action.id') log "Created action \"${action_id}\"" + + log "Waiting for action to complete..." + while true; do + resize_status=$(digital_ocean_api "actions/$action_id" | jq -r '.action.status') + if [[ "${resize_status}" == "completed" ]]; then + break + fi + sleep 1 + done + log "Volume resize complete!" } main