summaryrefslogtreecommitdiff
path: root/cmd/kpod/images.go
diff options
context:
space:
mode:
authorumohnani8 <umohnani@redhat.com>2017-11-29 16:56:18 -0500
committerumohnani8 <umohnani@redhat.com>2017-12-12 09:46:23 -0500
commit74ee579375654c79fa710f13b7c2ee3810366f82 (patch)
tree36f1b98582875e497b7e76457cb969d85cef6426 /cmd/kpod/images.go
parent88121e0747c03084c233d22fadfd3c227e73a885 (diff)
downloadpodman-74ee579375654c79fa710f13b7c2ee3810366f82.tar.gz
podman-74ee579375654c79fa710f13b7c2ee3810366f82.tar.bz2
podman-74ee579375654c79fa710f13b7c2ee3810366f82.zip
Update kpod inspect to use the new container state
kpod inspect now uses the new libpod container state and closely matches the output of docker inspect some aspects of it are still WIP as the libpod container state is still being worked on Signed-off-by: umohnani8 <umohnani@redhat.com>
Diffstat (limited to 'cmd/kpod/images.go')
-rw-r--r--cmd/kpod/images.go33
1 files changed, 16 insertions, 17 deletions
diff --git a/cmd/kpod/images.go b/cmd/kpod/images.go
index 7b020c984..1cf69c96d 100644
--- a/cmd/kpod/images.go
+++ b/cmd/kpod/images.go
@@ -6,7 +6,6 @@ import (
"strings"
"time"
- "github.com/containers/image/types"
"github.com/containers/storage"
"github.com/docker/go-units"
digest "github.com/opencontainers/go-digest"
@@ -208,18 +207,18 @@ func getImagesTemplateOutput(runtime *libpod.Runtime, images []*storage.Image, o
}
}
- info, imageDigest, size, _ := runtime.InfoAndDigestAndSize(*img)
- if info != nil {
- createdTime = info.Created
+ imgData, _ := runtime.GetImageInspectInfo(*img)
+ if imgData != nil {
+ createdTime = *imgData.Created
}
params := imagesTemplateParams{
Repository: repository,
Tag: tag,
ID: imageID,
- Digest: imageDigest,
+ Digest: imgData.Digest,
Created: units.HumanDuration(time.Since((createdTime))) + " ago",
- Size: units.HumanSizeWithPrecision(float64(size), 3),
+ Size: units.HumanSizeWithPrecision(float64(imgData.Size), 3),
}
imagesOutput = append(imagesOutput, params)
}
@@ -231,17 +230,17 @@ func getImagesJSONOutput(runtime *libpod.Runtime, images []*storage.Image) (imag
for _, img := range images {
createdTime := img.Created
- info, imageDigest, size, _ := runtime.InfoAndDigestAndSize(*img)
- if info != nil {
- createdTime = info.Created
+ imgData, _ := runtime.GetImageInspectInfo(*img)
+ if imgData != nil {
+ createdTime = *imgData.Created
}
params := imagesJSONParams{
ID: img.ID,
Name: img.Names,
- Digest: imageDigest,
+ Digest: imgData.Digest,
Created: createdTime,
- Size: size,
+ Size: imgData.Size,
}
imagesOutput = append(imagesOutput, params)
}
@@ -274,7 +273,7 @@ func generateImagesOutput(runtime *libpod.Runtime, images []*storage.Image, opts
func generateImagesFilter(params *libpod.ImageFilterParams, filterType string) libpod.ImageFilter {
switch filterType {
case "label":
- return func(image *storage.Image, info *types.ImageInspectInfo) bool {
+ return func(image *storage.Image, info *libpod.ImageData) bool {
if params == nil || params.Label == "" {
return true
}
@@ -291,21 +290,21 @@ func generateImagesFilter(params *libpod.ImageFilterParams, filterType string) l
return false
}
case "before-image":
- return func(image *storage.Image, info *types.ImageInspectInfo) bool {
+ return func(image *storage.Image, info *libpod.ImageData) bool {
if params == nil || params.BeforeImage.IsZero() {
return true
}
return info.Created.Before(params.BeforeImage)
}
case "since-image":
- return func(image *storage.Image, info *types.ImageInspectInfo) bool {
+ return func(image *storage.Image, info *libpod.ImageData) bool {
if params == nil || params.SinceImage.IsZero() {
return true
}
return info.Created.After(params.SinceImage)
}
case "dangling":
- return func(image *storage.Image, info *types.ImageInspectInfo) bool {
+ return func(image *storage.Image, info *libpod.ImageData) bool {
if params == nil || params.Dangling == "" {
return true
}
@@ -318,14 +317,14 @@ func generateImagesFilter(params *libpod.ImageFilterParams, filterType string) l
return false
}
case "reference":
- return func(image *storage.Image, info *types.ImageInspectInfo) bool {
+ return func(image *storage.Image, info *libpod.ImageData) bool {
if params == nil || params.ReferencePattern == "" {
return true
}
return libpod.MatchesReference(params.ImageName, params.ReferencePattern)
}
case "image-input":
- return func(image *storage.Image, info *types.ImageInspectInfo) bool {
+ return func(image *storage.Image, info *libpod.ImageData) bool {
if params == nil || params.ImageInput == "" {
return true
}