Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inspect: rename ImageID go field to Image #4195

Merged
merged 1 commit into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/podman/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ func inspectCmd(c *cliconfig.InspectValues) error {
if strings.Contains(outputFormat, ".Dst") {
outputFormat = strings.Replace(outputFormat, ".Dst", ".Destination", -1)
}
if strings.Contains(outputFormat, ".ImageID") {
outputFormat = strings.Replace(outputFormat, ".ImageID", ".Image", -1)
}
if latestContainer {
lc, err := runtime.GetLatestContainer()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions libpod/container_inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ type InspectContainerData struct {
Path string `json:"Path"`
Args []string `json:"Args"`
State *InspectContainerState `json:"State"`
ImageID string `json:"Image"`
Image string `json:"Image"`
ImageName string `json:"ImageName"`
Rootfs string `json:"Rootfs"`
Pod string `json:"Pod"`
Expand Down Expand Up @@ -718,7 +718,7 @@ func (c *Container) getContainerInspectData(size bool, driverData *driver.Data)
StartedAt: runtimeInfo.StartedTime,
FinishedAt: runtimeInfo.FinishedTime,
},
ImageID: config.RootfsImageID,
Image: config.RootfsImageID,
ImageName: config.RootfsImageName,
ExitCommand: config.ExitCommand,
Namespace: config.Namespace,
Expand Down
17 changes: 17 additions & 0 deletions test/e2e/inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,23 @@ var _ = Describe("Podman inspect", func() {
Expect(len(result.OutputToStringArray())).To(Equal(2))
})

It("podman inspect container and filter for Image{ID}", func() {
SkipIfRemote()
ls, ec, _ := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
cid := ls.OutputToString()

result := podmanTest.Podman([]string{"inspect", "--format={{.ImageID}}", cid})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
Expect(len(result.OutputToStringArray())).To(Equal(1))

result = podmanTest.Podman([]string{"inspect", "--format={{.Image}}", cid})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
Expect(len(result.OutputToStringArray())).To(Equal(1))
})

It("podman inspect -l with additional input should fail", func() {
SkipIfRemote()
result := podmanTest.Podman([]string{"inspect", "-l", "1234foobar"})
Expand Down