Skip to content

Commit

Permalink
cluster: print more clear warning when scale in with --force (#1477)
Browse files Browse the repository at this point in the history
  • Loading branch information
AstroProfundis committed Jul 14, 2021
1 parent 93a73f9 commit 9095a32
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions pkg/cluster/manager/scale_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,24 @@ func (m *Manager) ScaleIn(
nodes []string = gOpt.Nodes
)
if !skipConfirm {
if err := cliutil.PromptForConfirmOrAbortError(
"This operation will delete the %s nodes in `%s` and all their data.\nDo you want to continue? [y/N]:",
strings.Join(nodes, ","),
color.HiYellowString(name)); err != nil {
return err
}

if force {
if err := cliutil.PromptForConfirmOrAbortError(
"Forcing scale in is unsafe and may result in data lost for stateful components.\nDo you want to continue? [y/N]:",
color.HiRedString("Forcing scale in is unsafe and may result in data loss for stateful components.\n"+
"The process is irreversible and could NOT be cancelled.\n") +
"Only use `--force` when some of the servers are already permanently offline.\n" +
"Are you sure to continue? [y/N]:",
); err != nil {
return err
}
}

if err := cliutil.PromptForConfirmOrAbortError(
"This operation will delete the %s nodes in `%s` and all their data.\nDo you want to continue? [y/N]:",
strings.Join(nodes, ","),
color.HiYellowString(name)); err != nil {
return err
}

log.Infof("Scale-in nodes...")
}

Expand Down

0 comments on commit 9095a32

Please sign in to comment.