add confirmation prompt into pgo backup command, --no-prompt is supported for this command as well
@@ -23,6 +23,7 @@ import (
log "github.com/Sirupsen/logrus"
crv1 "github.com/crunchydata/postgres-operator/apis/cr/v1"
msgs "github.com/crunchydata/postgres-operator/apiservermsgs"
+ "github.com/crunchydata/postgres-operator/pgo/util"
"github.com/spf13/cobra"
"net/http"
"os"
@@ -38,7 +39,11 @@ var backupCmd = &cobra.Command{
if len(args) == 0 && Selector == "" {
fmt.Println(`You must specify the cluster to backup or a selector flag.`)
} else {
+ if util.AskForConfirmation(NoPrompt, "") {
createBackup(args)
+ } else {
+ fmt.Println("Aborting...")
+ }
}
},
