Detect whether a cluster exists before deleting it

pull/6/head
Erick Fejta 2016-10-20 12:08:32 -07:00
parent d249236fa9
commit a221e68c0c
1 changed files with 4 additions and 2 deletions

View File

@ -401,6 +401,8 @@ function test-teardown() {
function kube-down() {
echo "... in gke:kube-down()" >&2
detect-project >&2
"${GCLOUD}" ${CMD_GROUP:-} container clusters delete --project="${PROJECT}" \
--zone="${ZONE}" "${CLUSTER_NAME}" --quiet
if "${GCLOUD}" ${CMD_GROUP:-} container clusters describe --project="${PROJECT}" --zone="${ZONE}" "${CLUSTER_NAME}" --quiet &>/dev/null; then
"${GCLOUD}" ${CMD_GROUP:-} container clusters delete --project="${PROJECT}" \
--zone="${ZONE}" "${CLUSTER_NAME}" --quiet
fi
}