k8s: Fix a bug when manifest file ends with '---' (#139)

Any kubernetes manifest file ending with '---' will
generate an error when applied using 'k8s' module.

Although this may not be 'legal' YAML, this is quite frequent,
specially on helm's generated manifest files.

migrated from https://github.com/ansible/ansible/pull/59160

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde
2020-06-25 04:41:03 +05:30
committed by GitHub
parent 10b332d0a3
commit 9fb808c7f3
2 changed files with 4 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
bugfixes:
- raw - handle condition when definition is none (https://github.com/ansible/ansible/pull/59160).

View File

@@ -171,6 +171,8 @@ class KubernetesRawModule(KubernetesAnsibleModule):
flattened_definitions = []
for definition in self.resource_definitions:
if definition is None:
continue
kind = definition.get('kind', self.kind)
api_version = definition.get('apiVersion', self.api_version)
if kind.endswith('List'):