summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-01-15 10:27:36 -0800
committerGitHub <noreply@github.com>2019-01-15 10:27:36 -0800
commit1b2f75298d98f59fac73a63599cdca3478bef835 (patch)
tree414955b45a6675ed49e107e12c41778414d97798
parent6e47727d8ad7205d210b027ed03c1eb28b58ab9c (diff)
parent9a23e285d3ef7d356cb08cd431bcc6ffc7b579ab (diff)
downloadpodman-1b2f75298d98f59fac73a63599cdca3478bef835.tar.gz
podman-1b2f75298d98f59fac73a63599cdca3478bef835.tar.bz2
podman-1b2f75298d98f59fac73a63599cdca3478bef835.zip
Merge pull request #2161 from baude/remotehistory
add support for podman-remote history
-rw-r--r--cmd/podman/history.go10
-rw-r--r--libpod/adapter/runtime_remote.go25
-rw-r--r--test/e2e/history_test.go2
3 files changed, 30 insertions, 7 deletions
diff --git a/cmd/podman/history.go b/cmd/podman/history.go
index 7c8c619c8..802047071 100644
--- a/cmd/podman/history.go
+++ b/cmd/podman/history.go
@@ -1,15 +1,15 @@
package main
import (
+ "github.com/containers/libpod/libpod/adapter"
"reflect"
"strconv"
"strings"
"time"
"github.com/containers/libpod/cmd/podman/formats"
- "github.com/containers/libpod/cmd/podman/libpodruntime"
"github.com/containers/libpod/libpod/image"
- units "github.com/docker/go-units"
+ "github.com/docker/go-units"
"github.com/pkg/errors"
"github.com/urfave/cli"
)
@@ -72,11 +72,11 @@ func historyCmd(c *cli.Context) error {
return err
}
- runtime, err := libpodruntime.GetRuntime(c)
+ runtime, err := adapter.GetRuntime(c)
if err != nil {
return errors.Wrapf(err, "could not get runtime")
}
- defer runtime.Shutdown(false)
+ defer runtime.Runtime.Shutdown(false)
format := genHistoryFormat(c.String("format"), c.Bool("quiet"))
@@ -88,7 +88,7 @@ func historyCmd(c *cli.Context) error {
return errors.Errorf("podman history takes at most 1 argument")
}
- image, err := runtime.ImageRuntime().NewFromLocal(args[0])
+ image, err := runtime.NewImageFromLocal(args[0])
if err != nil {
return err
}
diff --git a/libpod/adapter/runtime_remote.go b/libpod/adapter/runtime_remote.go
index bb00350e0..5413385d2 100644
--- a/libpod/adapter/runtime_remote.go
+++ b/libpod/adapter/runtime_remote.go
@@ -221,3 +221,28 @@ func (r RemoteRuntime) RemoveImage(force bool) error {
func (r *LocalRuntime) RemoveImage(ctx context.Context, img *ContainerImage, force bool) (string, error) {
return iopodman.RemoveImage().Call(r.Conn, img.InputName, force)
}
+
+// History returns the history of an image and its layers
+func (ci *ContainerImage) History(ctx context.Context) ([]*image.History, error) {
+ var imageHistories []*image.History
+
+ reply, err := iopodman.HistoryImage().Call(ci.Runtime.Conn, ci.InputName)
+ if err != nil {
+ return nil, err
+ }
+ for _, h := range reply {
+ created, err := splitStringDate(h.Created)
+ if err != nil {
+ return nil, err
+ }
+ ih := image.History{
+ ID: h.Id,
+ Created: &created,
+ CreatedBy: h.CreatedBy,
+ Size: h.Size,
+ Comment: h.Comment,
+ }
+ imageHistories = append(imageHistories, &ih)
+ }
+ return imageHistories, nil
+}
diff --git a/test/e2e/history_test.go b/test/e2e/history_test.go
index 921dcaea0..9bec9ad13 100644
--- a/test/e2e/history_test.go
+++ b/test/e2e/history_test.go
@@ -1,5 +1,3 @@
-// +build !remoteclient
-
package integration
import (