Skip to content

Get user to confirm uninstall #313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion cortex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,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 ###
############
Expand Down Expand Up @@ -448,7 +463,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
Expand Down