From 7f150d54fbaa24a3a9a2abdb6db6fdd6bde26a97 Mon Sep 17 00:00:00 2001 From: yanxuean Date: Thu, 13 Sep 2018 14:52:34 +0800 Subject: [PATCH 1/2] crictl inspecti fail to unmarshal Signed-off-by: yanxuean --- cmd/crictl/util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/crictl/util.go b/cmd/crictl/util.go index d0c98e0f29..0c529a4d35 100644 --- a/cmd/crictl/util.go +++ b/cmd/crictl/util.go @@ -224,7 +224,7 @@ func outputStatusInfo(status string, info map[string]string, format string) erro for _, k := range keys { var res interface{} // We attempt to convert key into JSON if possible else use it directly - if err := json.Unmarshal([]byte(info[k]), res); err != nil { + if err := json.Unmarshal([]byte(info[k]), &res); err != nil { jsonInfo += "\"" + k + "\"" + ":" + "\"" + info[k] + "\"," } else { jsonInfo += "\"" + k + "\"" + ":" + info[k] + "," From 8e0e32e48b7a1be49a8774df17dac18b5fd7ca31 Mon Sep 17 00:00:00 2001 From: yanxuean Date: Thu, 13 Sep 2018 16:01:24 +0800 Subject: [PATCH 2/2] show concise digest and improve display Signed-off-by: yanxuean --- cmd/crictl/image.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/crictl/image.go b/cmd/crictl/image.go index 06898967d3..ed8276fe40 100644 --- a/cmd/crictl/image.go +++ b/cmd/crictl/image.go @@ -170,6 +170,7 @@ var listImageCommand = cli.Command{ id := image.Id if !noTrunc { id = getTruncatedID(id, "sha256:") + repoDigest = getTruncatedID(repoDigest, "sha256:") } for _, repoTagPair := range repoTagPairs { if showDigest { @@ -194,8 +195,9 @@ var listImageCommand = cli.Command{ fmt.Printf("Uid: %v\n", image.Uid) } if image.Username != "" { - fmt.Printf("Username: %v\n\n", image.Username) + fmt.Printf("Username: %v\n", image.Username) } + fmt.Printf("\n") } w.Flush() return nil