Skip to content
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

cluster: add significant warning destroying a cluster #1723

Merged
merged 2 commits into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
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
14 changes: 9 additions & 5 deletions pkg/cluster/manager/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,15 @@ func (m *Manager) DestroyCluster(name string, gOpt operator.Options, destroyOpt
}

if !skipConfirm {
if err := tui.PromptForConfirmOrAbortError(
"This operation will destroy %s %s cluster %s and its data.\nDo you want to continue? [y/N]:",
m.sysName,
color.HiYellowString(base.Version),
color.HiYellowString(name)); err != nil {
m.logger.Warnf(color.HiRedString(tui.ASCIIArtWarning))
if err := tui.PromptForAnswerOrAbortError(
"Yes, I know my cluster and data will be deleted.",
fmt.Sprintf("This operation will destroy %s %s cluster %s and its data.",
m.sysName,
color.HiYellowString(base.Version),
color.HiYellowString(name),
)+"\nAre you sure to continue?",
); err != nil {
return err
}
m.logger.Infof("Destroying cluster...")
Expand Down
2 changes: 1 addition & 1 deletion tests/tiup-cluster/script/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ EOEX

tiup-cluster _test $name writable

yes | tiup-cluster destroy $name
tiup-cluster --yes destroy $name
}
2 changes: 1 addition & 1 deletion tests/tiup-dm/test_upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ tiup-dm exec $name -N "$ipprefix.104:8261" --command "grep '31s' /home/tidb/depl
./script/task/run.sh


yes | tiup-dm destroy $name
tiup-dm --yes destroy $name