[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:
patchback[bot]
2026-01-26 17:43:17 +01:00
committed by GitHub
parent b5d57a35d6
commit 79a5e6745b
2 changed files with 7 additions and 1 deletions

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