Avoid re-parsing config history elements (#2981)

This commit is contained in:
Harshavardhana
2019-12-06 07:17:35 +05:30
committed by Nitish Tiwari
parent f3b2d5471f
commit da47ed8ac4
3 changed files with 7 additions and 9 deletions
+4 -6
View File
@@ -26,7 +26,6 @@ import (
json "github.com/minio/mc/pkg/colorjson"
"github.com/minio/mc/pkg/console"
"github.com/minio/mc/pkg/probe"
"github.com/minio/minio/pkg/madmin"
)
var historyListFlags = []cli.Flag{
@@ -74,9 +73,9 @@ Date: {{.CreateTime}}
var HistoryTemplate = template.Must(template.New("history-list").Funcs(funcMap).Parse(History))
type historyEntry struct {
RestoreID string `json:"restoreId"`
CreateTime string `json:"createTime"`
Targets madmin.Targets `json:"targets"`
RestoreID string `json:"restoreId"`
CreateTime string `json:"createTime"`
Targets string `json:"targets"`
}
// configHistoryMessage container to hold locks information.
@@ -144,8 +143,7 @@ func mainAdminConfigHistory(ctx *cli.Context) error {
RestoreID: chEntry.RestoreID,
CreateTime: chEntry.CreateTimeFormatted(),
}
hentries[i].Targets, e = madmin.ParseSubSysTarget([]byte(chEntry.Data))
fatalIf(probe.NewError(e), "Unable to parse invalid history entry.")
hentries[i].Targets = chEntry.Data
}
// Print
+1 -1
View File
@@ -15,7 +15,7 @@ require (
github.com/mattn/go-isatty v0.0.7
github.com/mattn/go-runewidth v0.0.5 // indirect
github.com/minio/cli v1.22.0
github.com/minio/minio v0.0.0-20191204233237-c9940d8c3f1f
github.com/minio/minio v0.0.0-20191205124742-d8e3de0cae46
github.com/minio/minio-go/v6 v6.0.43
github.com/minio/sha256-simd v0.1.1
github.com/mitchellh/go-homedir v1.1.0
+2 -2
View File
@@ -441,8 +441,8 @@ github.com/minio/minio v0.0.0-20190510004154-ac3b59645e92/go.mod h1:yFbQSwuA61mB
github.com/minio/minio v0.0.0-20190903181048-8a71b0ec5a72/go.mod h1:H8OUaOxwJIALXHlfMpk2ESvk81dW+F7tSnrZi7rln/k=
github.com/minio/minio v0.0.0-20190927193314-1c5b05c130fa/go.mod h1:47wx8w7yKTFAPw/hbmYPL4prsPivh6QuUqjTykftGgg=
github.com/minio/minio v0.0.0-20191001201215-ff5bf519522f/go.mod h1:+vpJpzImdz4NCQto3r6/vF/24jWeEs5i3lsDfRmEcl4=
github.com/minio/minio v0.0.0-20191204233237-c9940d8c3f1f h1:0Gm4h5JyOTpOfA8RRWdmE5ZGwCVp/TynsCdSt1BF1Mc=
github.com/minio/minio v0.0.0-20191204233237-c9940d8c3f1f/go.mod h1:3bY3lz9Uby83qOp5RsnPu4JJwiskVK088E7F4CRSdxI=
github.com/minio/minio v0.0.0-20191205124742-d8e3de0cae46 h1:6Oyny/iVD88fCrp3g4WbBjQJRdnzPZZO8aYI8tdONkY=
github.com/minio/minio v0.0.0-20191205124742-d8e3de0cae46/go.mod h1:3bY3lz9Uby83qOp5RsnPu4JJwiskVK088E7F4CRSdxI=
github.com/minio/minio-go v0.0.0-20190227180923-59af836a7e6d h1:gptD0/Hnam7h4Iq9D/33fscRpHfzOOUqUbH2nPw9HcU=
github.com/minio/minio-go v0.0.0-20190227180923-59af836a7e6d/go.mod h1:/haSOWG8hQNx2+JOfLJ9GKp61EAmgPwRVw/Sac0NzaM=
github.com/minio/minio-go v0.0.0-20190313212832-5d20267d970d/go.mod h1:/haSOWG8hQNx2+JOfLJ9GKp61EAmgPwRVw/Sac0NzaM=