mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-04-10 19:01:03 +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 }}'
|
||||
env:
|
||||
ANSIBLE_FORCE_COLOR: 'true'
|
||||
options:
|
||||
vvv: True
|
||||
scenario:
|
||||
name: default
|
||||
test_sequence:
|
||||
|
||||
@@ -299,7 +299,11 @@ class KubernetesRawModule(KubernetesAnsibleModule):
|
||||
else:
|
||||
if self.apply:
|
||||
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:
|
||||
try:
|
||||
k8s_obj = resource.apply(definition, namespace=namespace).to_dict()
|
||||
|
||||
Reference in New Issue
Block a user