Skip to content

Commit d1a9abc

Browse files
Reorder devcontainer failure handler to address race setting status (#384)
1 parent 3e243b3 commit d1a9abc

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

startupscript/butane/devcontainer-failure-handler.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,16 @@ echo "failed: $(date)" >> "${RETRY_FILE}"
2929
# Check if number of retries have exceeded maximum
3030
num_retries="$(wc -l < "${RETRY_FILE}")"
3131
if [[ "${num_retries}" -ge "${RETRY_COUNT}" ]]; then
32+
# Stop the service
33+
systemctl stop devcontainer.service
34+
3235
# Log failure
3336
source /home/core/metadata-utils.sh
3437
set_metadata "startup_script/status" "ERROR"
3538
error_message=$(get_guest_attribute "startup_script/message" "")
3639
if [[ -z "${error_message}" ]]; then
3740
set_metadata "startup_script/message" "There was an error launching your custom container on the VM. Please try recreating the VM."
3841
fi
39-
# Stop the service
40-
systemctl stop devcontainer.service
4142

4243
if [[ "$SHUTDOWN_ON_FAILURE" == "true" ]]; then
4344
# Sleep for a bit in case logs need to be captured

0 commit comments

Comments
 (0)