Export ConmonPidFile in 'podman inspect' for containers

This can help scripts provide a more meaningful message when coming
across issues [1] which require the container to be re-created.

[1] eg., https://github.com/containers/libpod/issues/2673

Signed-off-by: Debarshi Ray <rishi@fedoraproject.org>
This commit is contained in:
Debarshi Ray
2019-03-18 19:45:05 +01:00
parent 41019f7472
commit 022bb95c8e
3 changed files with 12 additions and 0 deletions

View File

@ -93,6 +93,7 @@ func (c *Container) getContainerInspectData(size bool, driverData *inspect.Data)
HostsPath: hostsPath, HostsPath: hostsPath,
StaticDir: config.StaticDir, StaticDir: config.StaticDir,
LogPath: config.LogPath, LogPath: config.LogPath,
ConmonPidFile: config.ConmonPidFile,
Name: config.Name, Name: config.Name,
Driver: driverData.Name, Driver: driverData.Name,
MountLabel: config.MountLabel, MountLabel: config.MountLabel,

View File

@ -158,6 +158,7 @@ type ContainerInspectData struct {
HostsPath string `json:"HostsPath"` HostsPath string `json:"HostsPath"`
StaticDir string `json:"StaticDir"` StaticDir string `json:"StaticDir"`
LogPath string `json:"LogPath"` LogPath string `json:"LogPath"`
ConmonPidFile string `json:"ConmonPidFile"`
Name string `json:"Name"` Name string `json:"Name"`
RestartCount int32 `json:"RestartCount"` //TODO RestartCount int32 `json:"RestartCount"` //TODO
Driver string `json:"Driver"` Driver string `json:"Driver"`

View File

@ -66,6 +66,16 @@ var _ = Describe("Podman inspect", func() {
Expect(session.ExitCode()).To(Equal(0)) Expect(session.ExitCode()).To(Equal(0))
}) })
It("podman inspect container with GO format for ConmonPidFile", func() {
SkipIfRemote()
session, ec, _ := podmanTest.RunLsContainer("test1")
Expect(ec).To(Equal(0))
session = podmanTest.Podman([]string{"inspect", "--format", "{{.ConmonPidFile}}", "test1"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
It("podman inspect container with size", func() { It("podman inspect container with size", func() {
SkipIfRemote() SkipIfRemote()
_, ec, _ := podmanTest.RunLsContainer("") _, ec, _ := podmanTest.RunLsContainer("")