mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-06-09 18:16:09 +00:00
Kubeconfig module improvement (#1123)
* Add kubeconfig module for managing Kubernetes config files * Remove unnecessary requirement & Change version * Move functions to module_utils * Add unit tests * Add kubeconfig module for managing Kubernetes config files * Remove unnecessary requirement & Change version * Move functions to module_utils * Add unit tests * Avoid linter errors * Improve documentation clarity * Redact sensitive kubeconfig information * Imprvoe verbosity * Move import statement for to_native to avoid linters check failure * Fix linting error * Add remove behavior * Add tests for remove behavior * Imporve documentation * Add changelog --------- Co-authored-by: Bianca Henderson <bianca@redhat.com>
This commit is contained in:
@@ -53,6 +53,8 @@ def merge_by_name(existing, new):
|
||||
if name in merged:
|
||||
if behavior == "keep":
|
||||
continue
|
||||
elif behavior == "remove":
|
||||
del merged[name]
|
||||
elif behavior == "replace":
|
||||
merged[name] = item_copy
|
||||
else:
|
||||
@@ -73,6 +75,8 @@ def merge_by_name(existing, new):
|
||||
result[key] = item_copy[key]
|
||||
merged[name] = result
|
||||
else:
|
||||
if behavior == "remove":
|
||||
continue
|
||||
merged[name] = item_copy
|
||||
|
||||
return list(merged.values())
|
||||
|
||||
Reference in New Issue
Block a user