From c6c65ee554793b6aad1839c8d552c75a2876a23f Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 20:35:33 +0100 Subject: [PATCH] [PR #9082/d27d86ec backport][stable-9] keycloak_clientscope: remove code turning attributes dict into list (#9117) keycloak_clientscope: remove code turning attributes dict into list (#9082) * remove code turning attributes dict into list * add changelog fragment (cherry picked from commit d27d86ecb108c391aa7c8153e9944a8369f8d065) Co-authored-by: fgruenbauer --- ...lientscope-fix-attributes-dict-turned-into-list.yml | 2 ++ plugins/modules/keycloak_clientscope.py | 10 ---------- 2 files changed, 2 insertions(+), 10 deletions(-) create mode 100644 changelogs/fragments/9082-keycloak_clientscope-fix-attributes-dict-turned-into-list.yml diff --git a/changelogs/fragments/9082-keycloak_clientscope-fix-attributes-dict-turned-into-list.yml b/changelogs/fragments/9082-keycloak_clientscope-fix-attributes-dict-turned-into-list.yml new file mode 100644 index 0000000000..c9d61780b2 --- /dev/null +++ b/changelogs/fragments/9082-keycloak_clientscope-fix-attributes-dict-turned-into-list.yml @@ -0,0 +1,2 @@ +bugfixes: + - keycloak_clientscope - fix diff and ``end_state`` by removing the code that turns the attributes dict, which contains additional config items, into a list (https://github.com/ansible-collections/community.general/pull/9082). \ No newline at end of file diff --git a/plugins/modules/keycloak_clientscope.py b/plugins/modules/keycloak_clientscope.py index 576a831bdb..35ac3d9500 100644 --- a/plugins/modules/keycloak_clientscope.py +++ b/plugins/modules/keycloak_clientscope.py @@ -317,9 +317,6 @@ def normalise_cr(clientscoperep, remove_ids=False): # Avoid the dict passed in to be modified clientscoperep = clientscoperep.copy() - if 'attributes' in clientscoperep: - clientscoperep['attributes'] = list(sorted(clientscoperep['attributes'])) - if 'protocolMappers' in clientscoperep: clientscoperep['protocolMappers'] = sorted(clientscoperep['protocolMappers'], key=lambda x: (x.get('name'), x.get('protocol'), x.get('protocolMapper'))) for mapper in clientscoperep['protocolMappers']: @@ -418,13 +415,6 @@ def main(): for clientscope_param in clientscope_params: new_param_value = module.params.get(clientscope_param) - # some lists in the Keycloak API are sorted, some are not. - if isinstance(new_param_value, list): - if clientscope_param in ['attributes']: - try: - new_param_value = sorted(new_param_value) - except TypeError: - pass # Unfortunately, the ansible argument spec checker introduces variables with null values when # they are not specified if clientscope_param == 'protocol_mappers':