keycloak_user_federation: remove `lastSync` param from kc API responses (#8812)

* remove `lastSync` param from kc API responses

* add blank line to satisfy sanity check

* add changelog fragment

* fix NoneType error introduced by changed normalize func return value
pull/8983/head
fgruenbauer 2024-10-03 14:38:09 +02:00 committed by GitHub
parent d4fb6bf8a6
commit 5d9a7ab240
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,2 @@
bugfixes:
- keycloak_user_federation - remove ``lastSync`` parameter from Keycloak responses to minimize diff/changes (https://github.com/ansible-collections/community.general/pull/8812).

View File

@ -722,12 +722,15 @@ from copy import deepcopy
def normalize_kc_comp(comp): def normalize_kc_comp(comp):
if 'config' in comp:
# kc completely removes the parameter `krbPrincipalAttribute` if it is set to `''`; the unset kc parameter is equivalent to `''`; # kc completely removes the parameter `krbPrincipalAttribute` if it is set to `''`; the unset kc parameter is equivalent to `''`;
# to make change detection and diff more accurate we set it again in the kc responses # to make change detection and diff more accurate we set it again in the kc responses
if 'config' in comp:
if 'krbPrincipalAttribute' not in comp['config']: if 'krbPrincipalAttribute' not in comp['config']:
comp['config']['krbPrincipalAttribute'] = [''] comp['config']['krbPrincipalAttribute'] = ['']
# kc stores a timestamp of the last sync in `lastSync` to time the periodic sync, it is removed to minimize diff/changes
comp['config'].pop('lastSync', None)
def sanitize(comp): def sanitize(comp):
compcopy = deepcopy(comp) compcopy = deepcopy(comp)