mirror of https://github.com/containers/podman.git
Merge pull request #6473 from mheon/fix_inspect_segfault
Fix a segfault in `podman inspect -l` w/ no containers
This commit is contained in:
commit
df0141dc20
|
@ -44,8 +44,10 @@ func getContainersAndInputByContext(all, latest bool, names []string, runtime *l
|
||||||
ctrs, err = runtime.GetAllContainers()
|
ctrs, err = runtime.GetAllContainers()
|
||||||
case latest:
|
case latest:
|
||||||
ctr, err = runtime.GetLatestContainer()
|
ctr, err = runtime.GetLatestContainer()
|
||||||
|
if err == nil {
|
||||||
rawInput = append(rawInput, ctr.ID())
|
rawInput = append(rawInput, ctr.ID())
|
||||||
ctrs = append(ctrs, ctr)
|
ctrs = append(ctrs, ctr)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
for _, n := range names {
|
for _, n := range names {
|
||||||
ctr, e := runtime.LookupContainer(n)
|
ctr, e := runtime.LookupContainer(n)
|
||||||
|
|
|
@ -171,4 +171,12 @@ var _ = Describe("Podman inspect", func() {
|
||||||
Expect(imageData[0].HealthCheck.Interval).To(BeNumerically("==", 60000000000))
|
Expect(imageData[0].HealthCheck.Interval).To(BeNumerically("==", 60000000000))
|
||||||
Expect(imageData[0].HealthCheck.Test).To(Equal([]string{"CMD-SHELL", "curl -f http://localhost/ || exit 1"}))
|
Expect(imageData[0].HealthCheck.Test).To(Equal([]string{"CMD-SHELL", "curl -f http://localhost/ || exit 1"}))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("podman inspect --latest with no container fails", func() {
|
||||||
|
SkipIfRemote()
|
||||||
|
|
||||||
|
session := podmanTest.Podman([]string{"inspect", "--latest"})
|
||||||
|
session.WaitWithDefaultTimeout()
|
||||||
|
Expect(session.ExitCode()).To(Not(Equal(0)))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue