From 5d9072030eaf6993a982945437bfc24e28f0fecb Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sat, 22 Jun 2024 11:05:25 +0200 Subject: [PATCH] [PR #8545/10535458 backport][stable-9] keycloak_clientscope: ignore ids on diff check (#8554) keycloak_clientscope: ignore ids on diff check (#8545) * keycloak_clientscope: ignore ids on diff check * keycloak_clientscope: add changelog fragment * keycloak_clientscope: Include changelog fragment change suggestion Co-authored-by: Felix Fontein --------- Co-authored-by: Felix Fontein (cherry picked from commit 1053545870f0f71eae8cb05dddc995f6ee737f50) Co-authored-by: Noah Lehmann <62204532+noahlehmann@users.noreply.github.com> --- .../8545-keycloak-clientscope-remove-id-on-compare.yml | 2 ++ plugins/modules/keycloak_clientscope.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/8545-keycloak-clientscope-remove-id-on-compare.yml diff --git a/changelogs/fragments/8545-keycloak-clientscope-remove-id-on-compare.yml b/changelogs/fragments/8545-keycloak-clientscope-remove-id-on-compare.yml new file mode 100644 index 0000000000..5986a45b87 --- /dev/null +++ b/changelogs/fragments/8545-keycloak-clientscope-remove-id-on-compare.yml @@ -0,0 +1,2 @@ +bugfixes: + - keycloak_clientscope - remove IDs from clientscope and its protocol mappers on comparison for changed check (https://github.com/ansible-collections/community.general/pull/8545). diff --git a/plugins/modules/keycloak_clientscope.py b/plugins/modules/keycloak_clientscope.py index b962b932c9..b8ee842195 100644 --- a/plugins/modules/keycloak_clientscope.py +++ b/plugins/modules/keycloak_clientscope.py @@ -472,7 +472,9 @@ def main(): # Process an update # no changes - if desired_clientscope == before_clientscope: + # remove ids for compare, problematic if desired has no ids set (not required), + # normalize for consentRequired in protocolMappers + if normalise_cr(desired_clientscope, remove_ids=True) == normalise_cr(before_clientscope, remove_ids=True): result['changed'] = False result['end_state'] = sanitize_cr(desired_clientscope) result['msg'] = "No changes required to clientscope {name}.".format(name=before_clientscope['name'])