From 088d5af87984e8e8348f3b70004d8107df645f73 Mon Sep 17 00:00:00 2001 From: umohnani8 Date: Thu, 21 Jun 2018 16:11:59 -0400 Subject: Podman history now prints out intermediate image IDs If the intermediate image exists in the store, podman history will show the IDs of the intermediate image of each layer. Signed-off-by: umohnani8 Closes: #982 Approved by: mheon --- pkg/varlinkapi/images.go | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'pkg') diff --git a/pkg/varlinkapi/images.go b/pkg/varlinkapi/images.go index 420962973..8e2669660 100644 --- a/pkg/varlinkapi/images.go +++ b/pkg/varlinkapi/images.go @@ -1,6 +1,7 @@ package varlinkapi import ( + "bytes" "encoding/json" "fmt" "io" @@ -8,7 +9,6 @@ import ( "strings" "time" - "bytes" "github.com/containers/image/docker" "github.com/containers/image/types" "github.com/docker/go-units" @@ -307,27 +307,19 @@ func (i *LibpodAPI) HistoryImage(call ioprojectatomicpodman.VarlinkCall, name st if err != nil { return call.ReplyImageNotFound(name) } - history, layerInfos, err := newImage.History(getContext()) + history, err := newImage.History(getContext()) if err != nil { return call.ReplyErrorOccurred(err.Error()) } - var ( - histories []ioprojectatomicpodman.ImageHistory - count = 1 - ) - for i := len(history) - 1; i >= 0; i-- { - var size int64 - if !history[i].EmptyLayer { - size = layerInfos[len(layerInfos)-count].Size - count++ - } + var histories []ioprojectatomicpodman.ImageHistory + for _, hist := range history { imageHistory := ioprojectatomicpodman.ImageHistory{ - Id: newImage.ID(), - Created: history[i].Created.String(), - CreatedBy: history[i].CreatedBy, + Id: hist.ID, + Created: hist.Created.String(), + CreatedBy: hist.CreatedBy, Tags: newImage.Names(), - Size: size, - Comment: history[i].Comment, + Size: hist.Size, + Comment: hist.Comment, } histories = append(histories, imageHistory) } -- cgit v1.2.3-54-g00ecf