mirror of
https://github.com/containers/podman.git
synced 2025-06-21 01:19:15 +08:00
Merge pull request #2771 from baude/issue2765
size is optional for container inspection
This commit is contained in:
4
API.md
4
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 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)
|
[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":
|
|||||||
### <a name="ContainerInspectData"></a>func ContainerInspectData
|
### <a name="ContainerInspectData"></a>func ContainerInspectData
|
||||||
<div style="background-color: #E8E8E8; padding: 15px; margin: 10px; border-radius: 10px;">
|
<div style="background-color: #E8E8E8; padding: 15px; margin: 10px; border-radius: 10px;">
|
||||||
|
|
||||||
method ContainerInspectData(name: [string](https://godoc.org/builtin#string)) [string](https://godoc.org/builtin#string)</div>
|
method ContainerInspectData(name: [string](https://godoc.org/builtin#string), size: [bool](https://godoc.org/builtin#bool)) [string](https://godoc.org/builtin#string)</div>
|
||||||
ContainerInspectData returns a container's inspect data in string form. This call is for
|
ContainerInspectData returns a container's inspect data in string form. This call is for
|
||||||
development of Podman only and generally should not be used.
|
development of Podman only and generally should not be used.
|
||||||
### <a name="ContainerRestore"></a>func ContainerRestore
|
### <a name="ContainerRestore"></a>func ContainerRestore
|
||||||
|
@ -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
|
# ContainerInspectData returns a container's inspect data in string form. This call is for
|
||||||
# development of Podman only and generally should not be used.
|
# 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
|
# ContainerStateData returns a container's state config in string form. This call is for
|
||||||
# development of Podman only and generally should not be used.
|
# development of Podman only and generally should not be used.
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
|
|
||||||
// Inspect returns an inspect struct from varlink
|
// Inspect returns an inspect struct from varlink
|
||||||
func (c *Container) Inspect(size bool) (*inspect.ContainerInspectData, error) {
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -519,12 +519,12 @@ func (i *LibpodAPI) ContainerArtifacts(call iopodman.VarlinkCall, name, artifact
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ContainerInspectData returns the inspect data of a container in string format
|
// 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)
|
ctr, err := i.Runtime.LookupContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyContainerNotFound(name, err.Error())
|
return call.ReplyContainerNotFound(name, err.Error())
|
||||||
}
|
}
|
||||||
data, err := ctr.Inspect(true)
|
data, err := ctr.Inspect(size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return call.ReplyErrorOccurred("unable to inspect container")
|
return call.ReplyErrorOccurred("unable to inspect container")
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,7 @@ var _ = Describe("Podman healthcheck run", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman healthcheck good check results in healthy even in start-period", 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 := 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()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
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() {
|
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 := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", "--healthcheck-retries", "2", "--healthcheck-command", "\"CMD-SHELL\" \"ls\" \"/foo\" \"||\" \"exit\" \"1\"", ALPINE, "top"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
|
Reference in New Issue
Block a user