mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-04 19:26:58 +00:00
[PR #11444/ccf61224 backport][stable-12] keycloak_client: 11443: Fix false change detection for null client attributes (#11451)
keycloak_client: 11443: Fix false change detection for null client attributes (#11444)
* 11443: fix diff for keycloak_client module for non existing client attributes
* 11443: code cleanup
* 11443: add changelog fragment
* Adjust changelog fragment.
---------
(cherry picked from commit ccf61224f1)
Co-authored-by: thomasbargetz <thomas.bargetz@gmail.com>
Co-authored-by: Thomas Bargetz <thomas.bargetz@rise-world.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
b5d57a35d6
commit
79a5e6745b
2 changed files with 7 additions and 1 deletions
|
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- keycloak_client - fix idempotency bug caused by ``null`` client attribute value differences for non-existing client attributes (https://github.com/ansible-collections/community.general/issues/11443, https://github.com/ansible-collections/community.general/pull/11444).
|
||||
|
|
@ -1319,7 +1319,11 @@ def main():
|
|||
new_param_value = flow_binding_from_dict_to_model(new_param_value, realm, kc)
|
||||
elif client_param == "attributes" and "attributes" in before_client:
|
||||
attributes_copy = copy.deepcopy(before_client["attributes"])
|
||||
attributes_copy.update(new_param_value)
|
||||
# Merge client attributes while excluding null-valued attributes that are not present in Keycloak's response.
|
||||
# This ensures idempotency by treating absent attributes and null attributes as equivalent.
|
||||
attributes_copy.update(
|
||||
{key: value for key, value in new_param_value.items() if value is not None or key in attributes_copy}
|
||||
)
|
||||
new_param_value = attributes_copy
|
||||
elif client_param in ["clientScopesBehavior", "client_scopes_behavior"]:
|
||||
continue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue