kubeyaml icon indicating copy to clipboard operation
kubeyaml copied to clipboard

Missing `kind` causes `TypeError` with multi-doc input

Open jstol opened this issue 5 years ago • 0 comments

Error Description

The check for a kind of 'List' in the manifests(...) function within kubeyaml.py (see here) causes a TypeError to be thrown when a subdocument is missing the kind field. I noticed this when pushing a multi-document manifest to a Flux-enabled repo. For example:

---
# This is a comment to mark that all documents below are Deployment configs
---
apiVersion: apps/v1beta2
kind: Deployment
...

Stack Trace

Traceback (most recent call last):
  File \"kubeyaml.py\", line 238, in <module>
  File \"kubeyaml.py\", line 233, in main
  File \"kubeyaml.py\", line 66, in apply_to_yaml
  File \"site-packages/ruamel/yaml/main.py\", line 452, in dump_all
  File \"kubeyaml.py\", line 73, in update_image
  File \"kubeyaml.py\", line 116, in manifests
TypeError: 'NoneType' object has no attribute '__getitem__'
Failed to execute script kubeyaml"

Additional Info

This error popped up after generating a multi-doc manifest file using a templated Helm chart. It formats the file in a style similar to this to mark which file each sub-document originated from.

jstol avatar May 28 '19 15:05 jstol