From e85cf1bb97fca6adfd1c2a1da1e0406b30356137 Mon Sep 17 00:00:00 2001 From: Zach Loafman Date: Mon, 22 Feb 2016 16:01:06 -0800 Subject: [PATCH] Attempt to delete node-template before retry I don't think we've seen this commonly, so I'm proposing a simplistic fix for now. Fixes #20878 --- cluster/gce/util.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cluster/gce/util.sh b/cluster/gce/util.sh index 92cd269d0f6..4aef9091c9a 100755 --- a/cluster/gce/util.sh +++ b/cluster/gce/util.sh @@ -396,6 +396,11 @@ function create-node-template { echo -e "${color_yellow}Attempt ${attempt} failed to create instance template $template_name. Retrying.${color_norm}" >&2 attempt=$(($attempt+1)) sleep $(($attempt * 5)) + + # In case the previous attempt failed with something like a + # Backend Error and left the entry laying around, delete it + # before we try again. + gcloud compute instance-templates delete "$template_name" --project "${PROJECT}" &>/dev/null || true else break fi