From 7f2221d48f7d0df8cc5beed70ff5dbc57bca3529 Mon Sep 17 00:00:00 2001 From: baude Date: Tue, 26 Mar 2019 08:08:40 -0500 Subject: size is optional for container inspection on the remote client, if a user wants to know the rootfs size of a container, a -s should be passed. this corrects a behavior where size was shown by default. Fixes #2765 Signed-off-by: baude --- API.md | 4 ++-- cmd/podman/varlink/io.podman.varlink | 2 +- pkg/adapter/containers_remote.go | 2 +- pkg/varlinkapi/containers.go | 4 ++-- test/e2e/healthcheck_run_test.go | 2 ++ 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/API.md b/API.md index 9751f5258..f7f5525bf 100755 --- a/API.md +++ b/API.md @@ -15,7 +15,7 @@ in the [API.md](https://github.com/containers/libpod/blob/master/API.md) file in [func ContainerExists(name: string) int](#ContainerExists) -[func ContainerInspectData(name: string) string](#ContainerInspectData) +[func ContainerInspectData(name: string, size: bool) string](#ContainerInspectData) [func ContainerRestore(name: string, keep: bool, tcpEstablished: bool) string](#ContainerRestore) @@ -300,7 +300,7 @@ $ varlink call -m unix:/run/podman/io.podman/io.podman.ContainerExists '{"name": ### func ContainerInspectData
-method ContainerInspectData(name: [string](https://godoc.org/builtin#string)) [string](https://godoc.org/builtin#string)
+method ContainerInspectData(name: [string](https://godoc.org/builtin#string), size: [bool](https://godoc.org/builtin#bool)) [string](https://godoc.org/builtin#string) ContainerInspectData returns a container's inspect data in string form. This call is for development of Podman only and generally should not be used. ### func ContainerRestore diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink index 5999210c8..ad2de56f8 100644 --- a/cmd/podman/varlink/io.podman.varlink +++ b/cmd/podman/varlink/io.podman.varlink @@ -1111,7 +1111,7 @@ method ContainerArtifacts(name: string, artifactName: string) -> (config: string # ContainerInspectData returns a container's inspect data in string form. This call is for # development of Podman only and generally should not be used. -method ContainerInspectData(name: string) -> (config: string) +method ContainerInspectData(name: string, size: bool) -> (config: string) # ContainerStateData returns a container's state config in string form. This call is for # development of Podman only and generally should not be used. diff --git a/pkg/adapter/containers_remote.go b/pkg/adapter/containers_remote.go index a8146567a..2982d6cbb 100644 --- a/pkg/adapter/containers_remote.go +++ b/pkg/adapter/containers_remote.go @@ -22,7 +22,7 @@ import ( // Inspect returns an inspect struct from varlink func (c *Container) Inspect(size bool) (*inspect.ContainerInspectData, error) { - reply, err := iopodman.ContainerInspectData().Call(c.Runtime.Conn, c.ID()) + reply, err := iopodman.ContainerInspectData().Call(c.Runtime.Conn, c.ID(), size) if err != nil { return nil, err } diff --git a/pkg/varlinkapi/containers.go b/pkg/varlinkapi/containers.go index 3185ba0e9..7a6ae3507 100644 --- a/pkg/varlinkapi/containers.go +++ b/pkg/varlinkapi/containers.go @@ -519,12 +519,12 @@ func (i *LibpodAPI) ContainerArtifacts(call iopodman.VarlinkCall, name, artifact } // ContainerInspectData returns the inspect data of a container in string format -func (i *LibpodAPI) ContainerInspectData(call iopodman.VarlinkCall, name string) error { +func (i *LibpodAPI) ContainerInspectData(call iopodman.VarlinkCall, name string, size bool) error { ctr, err := i.Runtime.LookupContainer(name) if err != nil { return call.ReplyContainerNotFound(name, err.Error()) } - data, err := ctr.Inspect(true) + data, err := ctr.Inspect(size) if err != nil { return call.ReplyErrorOccurred("unable to inspect container") } diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go index ec97fdf4a..cd2365ce7 100644 --- a/test/e2e/healthcheck_run_test.go +++ b/test/e2e/healthcheck_run_test.go @@ -135,6 +135,7 @@ var _ = Describe("Podman healthcheck run", func() { }) It("podman healthcheck good check results in healthy even in start-period", func() { + SkipIfRootless() session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", "--healthcheck-start-period", "2m", "--healthcheck-retries", "2", "--healthcheck-command", "\"CMD-SHELL\" \"ls\" \"||\" \"exit\" \"1\"", ALPINE, "top"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) @@ -148,6 +149,7 @@ var _ = Describe("Podman healthcheck run", func() { }) It("podman healthcheck single healthy result changes failed to healthy", func() { + SkipIfRootless() session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", "--healthcheck-retries", "2", "--healthcheck-command", "\"CMD-SHELL\" \"ls\" \"/foo\" \"||\" \"exit\" \"1\"", ALPINE, "top"}) session.WaitWithDefaultTimeout() Expect(session.ExitCode()).To(Equal(0)) -- cgit v1.2.3-54-g00ecf