fix bug - k8s was crashing when yaml ended with 3 dashes (#61182)
* fix bug - k8s was crashing when yaml ended with 3 dashes * #61182 - add changelog
This commit is contained in:
parent
7e1a347695
commit
8ed3a0b360
3 changed files with 28 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- k8s module - fix for case when resource definition yaml ended with 3 dashes
|
|
@ -136,6 +136,10 @@ class KubernetesRawModule(KubernetesAnsibleModule):
|
|||
src = self.params.get('src')
|
||||
if src:
|
||||
self.resource_definitions = self.load_resource_definitions(src)
|
||||
try:
|
||||
self.resource_definitions = [item for item in self.resource_definitions if item]
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
if not resource_definition and not src:
|
||||
implicit_definition = dict(
|
||||
|
|
|
@ -312,12 +312,29 @@
|
|||
- testing5
|
||||
register: k8s_info
|
||||
|
||||
|
||||
- name: Resources are terminating if still in results
|
||||
assert:
|
||||
that: not item.resources or item.resources[0].status.phase == "Terminating"
|
||||
loop: "{{ k8s_info.results }}"
|
||||
|
||||
- name: Create resources from a yaml string ending with ---
|
||||
k8s:
|
||||
definition: |+
|
||||
---
|
||||
kind: Namespace
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: testing6
|
||||
---
|
||||
|
||||
- name: Namespace should exist
|
||||
k8s_info:
|
||||
kind: Namespace
|
||||
api_version: v1
|
||||
name: testing6
|
||||
register: k8s_info_testing6
|
||||
failed_when: not k8s_info_testing6.resources or k8s_info_testing6.resources[0].status.phase != "Active"
|
||||
|
||||
- include_tasks: crd.yml
|
||||
- include_tasks: lists.yml
|
||||
- include_tasks: append_hash.yml
|
||||
|
@ -351,4 +368,8 @@
|
|||
apiVersion: v1
|
||||
metadata:
|
||||
name: testing5
|
||||
- kind: Namespace
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: testing6
|
||||
ignore_errors: yes
|
||||
|
|
Loading…
Reference in a new issue