From 9dfb284f1c7b479fe0a6f658185edef55e4bd5d9 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 5 Dec 2019 01:01:59 -0800 Subject: [PATCH] Avoid re-parsing config history elements --- cmd/admin-config-history.go | 10 ++++------ go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/cmd/admin-config-history.go b/cmd/admin-config-history.go index 41f97b273a..ffb791acfd 100644 --- a/cmd/admin-config-history.go +++ b/cmd/admin-config-history.go @@ -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 diff --git a/go.mod b/go.mod index 4dfc793f88..d74cab3885 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index d3199ed3af..d6dbabb86b 100644 --- a/go.sum +++ b/go.sum @@ -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=