Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Commit

Permalink
k8s: Fix a bug when manifest file ends with '---' (#139)
Browse files Browse the repository at this point in the history
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 ansible/ansible#59160

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
  • Loading branch information
Akasurde authored Jun 24, 2020
1 parent 10b332d commit 9fb808c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/59160_handle_none_def.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- raw - handle condition when definition is none (https://github.com/ansible/ansible/pull/59160).
2 changes: 2 additions & 0 deletions plugins/module_utils/raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ def execute_module(self):

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'):
Expand Down

0 comments on commit 9fb808c

Please sign in to comment.