From d815583d836fa16c75a8d5c1d4e912af274b8691 Mon Sep 17 00:00:00 2001 From: Ivan Zhang Date: Mon, 12 Aug 2019 15:23:47 -0400 Subject: [PATCH] progress --- cortex.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cortex.sh b/cortex.sh index 10daa034e8..120b4963be 100755 --- a/cortex.sh +++ b/cortex.sh @@ -387,6 +387,21 @@ function prompt_for_telemetry() { fi } +function confirm_for_uninstall() { + while true + do + echo + read -p "Are you sure you want to uninstall Cortex? Your cluster will be spun down and all resources will be deleted. [Y/n] " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + break + elif [[ $REPLY =~ ^[Nn]$ ]]; then + exit 0 + fi + echo "Unexpected value: $REPLY. Please enter \"Y\" or \"n\"" + done +} + ############ ### HELP ### ############ @@ -450,7 +465,7 @@ elif [ "$arg1" = "uninstall" ]; then show_help exit 1 elif [ "$arg2" = "" ]; then - uninstall_eks + confirm_for_uninstall && uninstall_eks elif [ "$arg2" = "cli" ]; then uninstall_cli elif [ "$arg2" = "" ]; then