[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 d27d86ecb1)

Co-authored-by: fgruenbauer <gruenbauer@b1-systems.de>
pull/9134/head
patchback[bot] 2024-11-11 20:35:33 +01:00 committed by GitHub
parent d385caa73f
commit c6c65ee554
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 10 deletions

View File

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

View File

@ -317,9 +317,6 @@ def normalise_cr(clientscoperep, remove_ids=False):
# Avoid the dict passed in to be modified # Avoid the dict passed in to be modified
clientscoperep = clientscoperep.copy() clientscoperep = clientscoperep.copy()
if 'attributes' in clientscoperep:
clientscoperep['attributes'] = list(sorted(clientscoperep['attributes']))
if 'protocolMappers' in clientscoperep: if 'protocolMappers' in clientscoperep:
clientscoperep['protocolMappers'] = sorted(clientscoperep['protocolMappers'], key=lambda x: (x.get('name'), x.get('protocol'), x.get('protocolMapper'))) clientscoperep['protocolMappers'] = sorted(clientscoperep['protocolMappers'], key=lambda x: (x.get('name'), x.get('protocol'), x.get('protocolMapper')))
for mapper in clientscoperep['protocolMappers']: for mapper in clientscoperep['protocolMappers']:
@ -418,13 +415,6 @@ def main():
for clientscope_param in clientscope_params: for clientscope_param in clientscope_params:
new_param_value = module.params.get(clientscope_param) 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 # Unfortunately, the ansible argument spec checker introduces variables with null values when
# they are not specified # they are not specified
if clientscope_param == 'protocol_mappers': if clientscope_param == 'protocol_mappers':