summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2019-09-26 09:37:41 -0400
committerMatthew Heon <mheon@redhat.com>2019-09-26 09:39:01 -0400
commit0cae686c7fb9af3798c8eec09aadded074d259d3 (patch)
treeb18f1fe803e4fe28290aa3012fde04801b41fa7e
parent83b2348313c52cc3e20d72285a9d81d3d72c2d5d (diff)
downloadpodman-0cae686c7fb9af3798c8eec09aadded074d259d3.tar.gz
podman-0cae686c7fb9af3798c8eec09aadded074d259d3.tar.bz2
podman-0cae686c7fb9af3798c8eec09aadded074d259d3.zip
Add an error for pods without a name
Signed-off-by: Matthew Heon <mheon@redhat.com>
-rw-r--r--pkg/adapter/pods.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/adapter/pods.go b/pkg/adapter/pods.go
index 70293a2c5..2613401b8 100644
--- a/pkg/adapter/pods.go
+++ b/pkg/adapter/pods.go
@@ -469,6 +469,9 @@ func (r *LocalRuntime) PlayKubeYAML(ctx context.Context, c *cliconfig.KubePlayVa
// check for name collision between pod and container
podName := podYAML.ObjectMeta.Name
+ if podName == "" {
+ return nil, errors.Errorf("pod does not have a name")
+ }
for _, n := range podYAML.Spec.Containers {
if n.Name == podName {
fmt.Printf("a container exists with the same name (%s) as the pod in your YAML file; changing pod name to %s_pod\n", podName, podName)