mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-08 14:02:38 +00:00
Fix apply patching results in check mode
apply_object returns only the patch - we need to actually apply the patch to the existing object. Fixes ansible/ansible#66780
This commit is contained in:
@@ -21,6 +21,8 @@ provisioner:
|
|||||||
ansible_python_interpreter: '{{ ansible_playbook_python }}'
|
ansible_python_interpreter: '{{ ansible_playbook_python }}'
|
||||||
env:
|
env:
|
||||||
ANSIBLE_FORCE_COLOR: 'true'
|
ANSIBLE_FORCE_COLOR: 'true'
|
||||||
|
options:
|
||||||
|
vvv: True
|
||||||
scenario:
|
scenario:
|
||||||
name: default
|
name: default
|
||||||
test_sequence:
|
test_sequence:
|
||||||
|
|||||||
@@ -299,7 +299,11 @@ class KubernetesRawModule(KubernetesAnsibleModule):
|
|||||||
else:
|
else:
|
||||||
if self.apply:
|
if self.apply:
|
||||||
if self.check_mode:
|
if self.check_mode:
|
||||||
ignored, k8s_obj = apply_object(resource, definition)
|
ignored, patch = apply_object(resource, definition)
|
||||||
|
if existing:
|
||||||
|
k8s_obj = dict_merge(existing.to_dict(), patch)
|
||||||
|
else:
|
||||||
|
k8s_obj = patch
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
k8s_obj = resource.apply(definition, namespace=namespace).to_dict()
|
k8s_obj = resource.apply(definition, namespace=namespace).to_dict()
|
||||||
|
|||||||
Reference in New Issue
Block a user