summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorumohnani8 <umohnani@redhat.com>2018-06-21 16:11:59 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-06-22 15:19:34 +0000
commit088d5af87984e8e8348f3b70004d8107df645f73 (patch)
tree6a2400e1660620f8f6291c8aa7822a29543bbc12 /pkg
parent89af35175d97cf90e7336d3c817612fafc68dbdb (diff)
downloadpodman-088d5af87984e8e8348f3b70004d8107df645f73.tar.gz
podman-088d5af87984e8e8348f3b70004d8107df645f73.tar.bz2
podman-088d5af87984e8e8348f3b70004d8107df645f73.zip
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 <umohnani@redhat.com> Closes: #982 Approved by: mheon
Diffstat (limited to 'pkg')
-rw-r--r--pkg/varlinkapi/images.go26
1 files changed, 9 insertions, 17 deletions
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)
}