Optionally suppress delete confirmation

This commit is contained in:
Michael Vines
2018-09-06 10:28:26 -07:00
parent eaef9be710
commit aa07bdfbaa
2 changed files with 16 additions and 5 deletions

View File

@ -149,11 +149,18 @@ gcloud_CreateInstances() {
}
#
# gcloud_DeleteInstances
# gcloud_DeleteInstances [yes]
#
# Deletes all the instances listed in the `instances` array
#
# If yes = "true", skip the delete confirmation
#
gcloud_DeleteInstances() {
declare maybeQuiet=
if [[ $1 = true ]]; then
maybeQuiet=--quiet
fi
if [[ ${#instances[0]} -eq 0 ]]; then
echo No instances to delete
return
@ -167,7 +174,7 @@ gcloud_DeleteInstances() {
(
set -x
gcloud beta compute instances delete --zone "$zone" "${names[@]}"
gcloud beta compute instances delete --zone "$zone" $maybeQuiet "${names[@]}"
)
}