mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-06 13:02:37 +00:00
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:
2
changelogs/fragments/59160_handle_none_def.yml
Normal file
2
changelogs/fragments/59160_handle_none_def.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- raw - handle condition when definition is none (https://github.com/ansible/ansible/pull/59160).
|
||||
@@ -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'):
|
||||
|
||||
Reference in New Issue
Block a user