Merge pull request #8056 from xordspar0/invalid-image

Make invalid image name error more specific
This commit is contained in:
OpenShift Merge Robot
2020-10-19 15:49:11 -04:00
committed by GitHub
2 changed files with 20 additions and 1 deletions

View File

@ -341,7 +341,7 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
}
named, err := reference.ParseNormalizedNamed(container.Image)
if err != nil {
return nil, err
return nil, errors.Wrapf(err, "Failed to parse image %q", container.Image)
}
// In kube, if the image is tagged with latest, it should always pull
if tagged, isTagged := named.(reference.NamedTagged); isTagged {

View File

@ -1447,4 +1447,23 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
Expect(inspect.OutputToString()).To(ContainSubstring("Memory: " + expectedMemoryLimit))
}
})
It("podman play kube reports invalid image name", func() {
invalidImageName := "./myimage"
pod := getPod(
withCtr(
getCtr(
withImage(invalidImageName),
),
),
)
err := generateKubeYaml("pod", pod, kubeYaml)
Expect(err).To(BeNil())
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
kube.WaitWithDefaultTimeout()
Expect(kube.ExitCode()).To(Equal(125))
Expect(kube.ErrorToString()).To(ContainSubstring(invalidImageName))
})
})