admin update: Add a prompt for confirmation (#4400)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user