Skip to content

Commit

Permalink
Merge pull request #378 from yanxuean/json-error
Browse files Browse the repository at this point in the history
crictl inspecti fail to unmarshal
  • Loading branch information
k8s-ci-robot authored Sep 13, 2018
2 parents 31e2aec + 8e0e32e commit ac3af29
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cmd/crictl/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/crictl/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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] + ","
Expand Down

0 comments on commit ac3af29

Please sign in to comment.