Inspect output should be in array form

Inspect should be able to inspect one or more containers depending
on the user input.  Therefore, inspect output should be in array
format so the consumer could potentially iterate it.  This PR allows
users to specify one more or containers|images|or a mix for
inspection.  The output, as stated, is therefore in array form.  This
holds true even for a singular image.

In the case that the user enters an invalid container|image "name", we
handle that gracefully.  Podman will output json for the valid names
until it reaches the invalid one.  For example:

In this case, podman will out the json for alpine and then print an
error about 123 being invalid.  It will not continute onto busybox.
This behavior imatates docker.

This addresses issue #360

Signed-off-by: baude <bbaude@redhat.com>

Closes: #371
Approved by: baude
This commit is contained in:
baude
2018-02-20 10:57:37 -06:00
committed by Atomic Bot
parent e929e7de4c
commit 6ce70a33c5
8 changed files with 125 additions and 84 deletions

View File

@ -40,7 +40,7 @@ var _ = Describe("Podman commit", func() {
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout()
data := check.InspectImageJSON()
Expect(StringInSlice("foobar.com/test1-image:latest", data.RepoTags)).To(BeTrue())
Expect(StringInSlice("foobar.com/test1-image:latest", data[0].RepoTags)).To(BeTrue())
})
It("podman commit container with message", func() {
@ -55,7 +55,7 @@ var _ = Describe("Podman commit", func() {
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout()
data := check.InspectImageJSON()
Expect(data.Comment).To(Equal("testing-commit"))
Expect(data[0].Comment).To(Equal("testing-commit"))
})
It("podman commit container with author", func() {
@ -70,7 +70,7 @@ var _ = Describe("Podman commit", func() {
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
check.WaitWithDefaultTimeout()
data := check.InspectImageJSON()
Expect(data.Author).To(Equal("snoopy"))
Expect(data[0].Author).To(Equal("snoopy"))
})
It("podman commit container with change flag", func() {
@ -88,7 +88,7 @@ var _ = Describe("Podman commit", func() {
check.WaitWithDefaultTimeout()
data := check.InspectImageJSON()
foundBlue := false
for _, i := range data.Labels {
for _, i := range data[0].Labels {
if i == "blue" {
foundBlue = true
break