Skip to content

Commit

Permalink
Add finalized command line options (#2979)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored Dec 5, 2019
1 parent 3f426ff commit f3b2d54
Show file tree
Hide file tree
Showing 12 changed files with 184 additions and 333 deletions.
32 changes: 5 additions & 27 deletions cmd/admin-config-export.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@ package cmd

import (
"encoding/json"
"strings"

"github.com/minio/cli"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio/pkg/madmin"
)

var adminConfigExportCmd = cli.Command{
Name: "export",
Usage: "export config of a MinIO server/cluster",
Usage: "export all config keys to STDOUT",
Before: setGlobalsFromContext,
Action: mainAdminConfigExport,
Flags: globalFlags,
Expand All @@ -48,30 +46,13 @@ EXAMPLES:

// configExportMessage container to hold locks information.
type configExportMessage struct {
Status string `json:"status"`
Value madmin.Targets `json:"value"`
Status string `json:"status"`
Value []byte `json:"value"`
}

// String colorized service status message.
func (u configExportMessage) String() string {
var s strings.Builder
count := u.Value.Count()
// Print all "on" states entries
for _, targetKV := range u.Value {
kv := targetKV.KVS
count--
if kv.Get(madmin.StateKey) == madmin.StateOff {
s.WriteString(madmin.KvComment)
s.WriteString(madmin.KvSpaceSeparator)
}
s.WriteString(targetKV.SubSystem)
s.WriteString(madmin.KvSpaceSeparator)
s.WriteString(kv.String())
if len(u.Value) > 1 && count > 0 {
s.WriteString(madmin.KvNewline)
}
}
return s.String()
return string(u.Value)
}

// JSON jsonified service status Message message.
Expand Down Expand Up @@ -106,12 +87,9 @@ func mainAdminConfigExport(ctx *cli.Context) error {
buf, e := client.GetConfig()
fatalIf(probe.NewError(e), "Cannot get server config")

tgts, e := madmin.ParseSubSysTarget(buf)
fatalIf(probe.NewError(e), "Cannot get server config")

// Print
printMsg(configExportMessage{
Value: tgts,
Value: buf,
})

return nil
Expand Down
2 changes: 1 addition & 1 deletion cmd/admin-config-get.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

var adminConfigGetCmd = cli.Command{
Name: "get",
Usage: "get config of a MinIO server/cluster",
Usage: "interactively retrieve a config key parameters",
Before: setGlobalsFromContext,
Action: mainAdminConfigGet,
Flags: globalFlags,
Expand Down
100 changes: 0 additions & 100 deletions cmd/admin-config-history-clear.go

This file was deleted.

145 changes: 0 additions & 145 deletions cmd/admin-config-history-list.go

This file was deleted.

Loading

0 comments on commit f3b2d54

Please sign in to comment.