From 62cb6087b59064798a51fb90958300827343fdce Mon Sep 17 00:00:00 2001 From: fgruenbauer Date: Mon, 11 Nov 2024 20:01:47 +0100 Subject: [PATCH] keycloak_client: remove code that turns attributes dict into list (#9077) * remove code that turns attributes dict into list * add changelog fragment * Update changelogs/fragments/9077-keycloak_client-fix-attributes-dict-turned-into-list.yml Co-authored-by: Felix Fontein --------- Co-authored-by: Felix Fontein --- ...oak_client-fix-attributes-dict-turned-into-list.yml | 2 ++ plugins/modules/keycloak_client.py | 10 ---------- 2 files changed, 2 insertions(+), 10 deletions(-) create mode 100644 changelogs/fragments/9077-keycloak_client-fix-attributes-dict-turned-into-list.yml diff --git a/changelogs/fragments/9077-keycloak_client-fix-attributes-dict-turned-into-list.yml b/changelogs/fragments/9077-keycloak_client-fix-attributes-dict-turned-into-list.yml new file mode 100644 index 0000000000..d693c2e139 --- /dev/null +++ b/changelogs/fragments/9077-keycloak_client-fix-attributes-dict-turned-into-list.yml @@ -0,0 +1,2 @@ +bugfixes: + - keycloak_client - fix diff by removing code that turns the attributes dict which contains additional settings into a list (https://github.com/ansible-collections/community.general/pull/9077). \ No newline at end of file diff --git a/plugins/modules/keycloak_client.py b/plugins/modules/keycloak_client.py index d2800be292..62015bc79f 100644 --- a/plugins/modules/keycloak_client.py +++ b/plugins/modules/keycloak_client.py @@ -805,9 +805,6 @@ def normalise_cr(clientrep, remove_ids=False): # Avoid the dict passed in to be modified clientrep = clientrep.copy() - if 'attributes' in clientrep: - clientrep['attributes'] = list(sorted(clientrep['attributes'])) - if 'defaultClientScopes' in clientrep: clientrep['defaultClientScopes'] = list(sorted(clientrep['defaultClientScopes'])) @@ -1024,13 +1021,6 @@ def main(): for client_param in client_params: new_param_value = module.params.get(client_param) - # some lists in the Keycloak API are sorted, some are not. - if isinstance(new_param_value, list): - if client_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 client_param == 'protocol_mappers':