Commit 5c049ec
authored
Fix UnboundLocalError generating a diff (#390)
This happens when two resources of different kind are compared
or if 'kind' is missing in the dict.
Traceback (most recent call last):
File "/tmp/ansible_k8s_payload_trnxlugx/ansible_k8s_payload.zip/ansible_collections/community/kubernetes/plugins/modules/k8s.py", line 320, in <module>
File "/tmp/ansible_k8s_payload_trnxlugx/ansible_k8s_payload.zip/ansible_collections/community/kubernetes/plugins/modules/k8s.py", line 316, in main
File "/tmp/ansible_k8s_payload_trnxlugx/ansible_k8s_payload.zip/ansible_collections/community/kubernetes/plugins/module_utils/common.py", line 548, in execute_module
File "/tmp/ansible_k8s_payload_trnxlugx/ansible_k8s_payload.zip/ansible_collections/community/kubernetes/plugins/module_utils/common.py", line 760, in perform_action
File "/tmp/ansible_k8s_payload_trnxlugx/ansible_k8s_payload.zip/ansible_collections/community/kubernetes/plugins/module_utils/common.py", line 347, in diff_objects
File "/home/linosteiner/.local/lib/python3.9/site-packages/openshift/dynamic/apply.py", line 232, in recursive_diff
result = recursive_list_diff(dict1[k], dict2[k], this_position)
UnboundLocalError: local variable 'this_position' referenced before assignment1 parent 32737c0 commit 5c049ec
2 files changed
+46
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
227 | | - | |
| 226 | + | |
228 | 227 | | |
229 | 228 | | |
230 | 229 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
64 | 109 | | |
65 | 110 | | |
66 | 111 | | |
| |||
0 commit comments