summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi/images.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-04-30 16:09:44 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-04-30 22:22:08 +0000
commit7a0a8552cb4af7af6fc6fb458fd41776f57f543c (patch)
tree17ef51ef1901ea339bdddc2201069e5dc86363a3 /pkg/varlinkapi/images.go
parent2239093a6321ac3fb634117e69de73017530a498 (diff)
downloadpodman-7a0a8552cb4af7af6fc6fb458fd41776f57f543c.tar.gz
podman-7a0a8552cb4af7af6fc6fb458fd41776f57f543c.tar.bz2
podman-7a0a8552cb4af7af6fc6fb458fd41776f57f543c.zip
Fix misc stuff found by jhonce
During the python client implementation, jhonce found some return types that needed correction as well as a panic related to history which is now corrected. Signed-off-by: baude <bbaude@redhat.com> Closes: #704 Approved by: rhatdan
Diffstat (limited to 'pkg/varlinkapi/images.go')
-rw-r--r--pkg/varlinkapi/images.go22
1 files changed, 15 insertions, 7 deletions
diff --git a/pkg/varlinkapi/images.go b/pkg/varlinkapi/images.go
index 29fe803ae..e2a9c4d5b 100644
--- a/pkg/varlinkapi/images.go
+++ b/pkg/varlinkapi/images.go
@@ -92,15 +92,23 @@ func (i *LibpodAPI) HistoryImage(call ioprojectatomicpodman.VarlinkCall, name st
if err != nil {
return call.ReplyErrorOccurred(err.Error())
}
- var histories []ioprojectatomicpodman.ImageHistory
- for i, h := range history {
+ 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++
+ }
imageHistory := ioprojectatomicpodman.ImageHistory{
Id: newImage.ID(),
- Created: h.Created.String(),
- CreatedBy: h.CreatedBy,
+ Created: history[i].Created.String(),
+ CreatedBy: history[i].CreatedBy,
Tags: newImage.Names(),
- Size: layerInfos[i].Size,
- Comment: h.Comment,
+ Size: size,
+ Comment: history[i].Comment,
}
histories = append(histories, imageHistory)
}
@@ -165,7 +173,7 @@ func (i *LibpodAPI) RemoveImage(call ioprojectatomicpodman.VarlinkCall, name str
if err := newImage.Remove(force); err != nil {
return call.ReplyErrorOccurred(err.Error())
}
- return call.ReplyRemoveImage()
+ return call.ReplyRemoveImage(newImage.ID())
}
// SearchImage searches all registries configured in /etc/containers/registries.conf for an image