do not print config values in base64 (#3757)

fixes #3696
This commit is contained in:
Harshavardhana
2021-07-19 08:29:20 -07:00
committed by GitHub
parent bfafb96632
commit c319567430
5 changed files with 42 additions and 25 deletions
+1 -1
View File
@@ -8,11 +8,11 @@ linters-settings:
linters:
disable-all: true
enable:
- revive
- typecheck
- goimports
- misspell
- govet
- golint
- ineffassign
- gosimple
- deadcode
+2 -2
View File
@@ -18,8 +18,8 @@ checks:
getdeps:
@mkdir -p ${GOPATH}/bin
@which golangci-lint 1>/dev/null || (echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.27.0)
@which stringer 1>/dev/null || (echo "Installing stringer" && go get golang.org/x/tools/cmd/stringer)
@echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.40.1
@which stringer 1>/dev/null || (echo "Installing stringer" && go install -v golang.org/x/tools/cmd/stringer@v0.1.5)
crosscompile:
@(env bash $(PWD)/buildscripts/cross-compile.sh)
+25 -8
View File
@@ -22,6 +22,7 @@ import (
"github.com/minio/cli"
json "github.com/minio/colorjson"
"github.com/minio/madmin-go"
"github.com/minio/mc/pkg/probe"
)
@@ -58,13 +59,14 @@ EXAMPLES:
// configGetMessage container to hold locks information.
type configGetMessage struct {
Status string `json:"status"`
Value []byte `json:"value"`
Status string `json:"status"`
Value *madmin.Target `json:"value"`
value []byte
}
// String colorized service status message.
func (u configGetMessage) String() string {
return string(u.Value)
return string(u.value)
}
// JSON jsonified service status Message message.
@@ -109,14 +111,29 @@ func mainAdminConfigGet(ctx *cli.Context) error {
return nil
}
subSys := strings.Join(args.Tail(), " ")
// Call get config API
buf, e := client.GetConfigKV(globalContext, strings.Join(args.Tail(), " "))
buf, e := client.GetConfigKV(globalContext, subSys)
fatalIf(probe.NewError(e), "Unable to get server '%s' config", args.Tail())
// Print
printMsg(configGetMessage{
Value: buf,
})
if globalJSON {
hr, e := client.HelpConfigKV(globalContext, subSys, "", false)
fatalIf(probe.NewError(e), "Unable to get help for "+subSys+" the sub-system")
tgt, e := madmin.ParseSubSysTarget(buf, hr)
fatalIf(probe.NewError(e), "Unable to parse sub-system target "+subSys)
printMsg(configGetMessage{
Value: tgt,
value: buf,
})
} else {
// Print
printMsg(configGetMessage{
value: buf,
})
}
return nil
}
+13 -13
View File
@@ -40,34 +40,34 @@ const (
var adminHealFlags = []cli.Flag{
cli.StringFlag{
Name: "scan",
Usage: "[DEPRECATED] select the healing scan mode (normal/deep)",
Usage: "select the healing scan mode (normal/deep)",
Value: scanNormalMode,
},
cli.BoolFlag{
Name: "recursive, r",
Usage: "[DEPRECATED] heal recursively",
Usage: "heal recursively",
},
cli.BoolFlag{
Name: "dry-run, n",
Usage: "[DEPRECATED] only inspect data, but do not mutate",
Usage: "only inspect data, but do not mutate",
},
cli.BoolFlag{
Name: "force-start, f",
Usage: "[DEPRECATED] force start a new heal sequence",
Usage: "force start a new heal sequence",
},
cli.BoolFlag{
Name: "force-stop, s",
Usage: "[DEPRECATED] force stop a running heal sequence",
Usage: "force stop a running heal sequence",
},
cli.BoolFlag{
Name: "remove",
Usage: "[DEPRECATED] remove dangling objects in heal sequence",
Usage: "remove dangling objects in heal sequence",
},
}
var adminHealCmd = cli.Command{
Name: "heal",
Usage: "[DEPRECATED] heal disks, buckets and objects on MinIO server",
Usage: "heal disks, buckets and objects on MinIO server",
Action: mainAdminHeal,
OnUsageError: onUsageError,
Before: setGlobalsFromContext,
@@ -82,12 +82,12 @@ USAGE:
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}
SCAN MODES:
normal (default): Heal objects which are missing on one or more disks.
deep : Heal objects which are missing or with silent data corruption on one or more disks.
DEPRECATED:
MinIO server now supports auto-heal, this command will be removed in future.
EXAMPLES:
1. Monitor healing status on a running server at alias 'myminio':
{{.Prompt}} {{.HelpName}} myminio/
Objects Healed: 7/27 (25.9%), 31 MB/110 MB (0%)
Heal rate: 3 obj/s, 10 MB/s
Estimated Completion: 11 seconds
`,
}
+1 -1
View File
@@ -185,7 +185,7 @@ func (opts LifecycleOptions) ToConfig(config *lifecycle.Configuration) (*lifecyc
// GetLifecycleOptions create LifeCycleOptions based on cli inputs
func GetLifecycleOptions(ctx *cli.Context) LifecycleOptions {
var id string = ctx.String("id")
id := ctx.String("id")
if id == "" {
id = xid.New().String()
}