1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-04 07:51:50 +00:00

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.

---------

Co-authored-by: Thomas Bargetz <thomas.bargetz@rise-world.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
thomasbargetz 2026-01-26 17:16:33 +01:00 committed by GitHub
parent 53e1e86bcc
commit ccf61224f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -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).

View file

@ -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