diff --git a/cmd/admin-update.go b/cmd/admin-update.go index 97590d13..87cd919d 100644 --- a/cmd/admin-update.go +++ b/cmd/admin-update.go @@ -18,7 +18,10 @@ package cmd import ( + "bufio" "fmt" + "os" + "strings" "github.com/fatih/color" "github.com/minio/cli" @@ -103,6 +106,17 @@ func mainAdminServerUpdate(ctx *cli.Context) error { updateURL := args.Get(1) + if isTerminal() { + fmt.Printf("You are about to upgrade *MinIO Server*, please confirm [y/N]: ") + answer, e := bufio.NewReader(os.Stdin).ReadString('\n') + fatalIf(probe.NewError(e), "Unable to parse user input.") + answer = strings.TrimSpace(answer) + if answer = strings.ToLower(answer); answer != "y" && answer != "yes" { + fmt.Println("Upgrade aborted!") + return nil + } + } + // Update the specified MinIO server, optionally also // with the provided update URL. us, e := client.ServerUpdate(globalContext, updateURL)