[PR #8812/5d9a7ab2 backport][stable-8] keycloak_user_federation: remove `lastSync` param from kc API responses (#8976)

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

(cherry picked from commit 5d9a7ab240)

Co-authored-by: fgruenbauer <gruenbauer@b1-systems.de>
pull/8985/head
patchback[bot] 2024-10-03 16:12:53 +03:00 committed by GitHub
parent 715e6706cc
commit 214f0be60d
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

@ -714,12 +714,15 @@ from copy import deepcopy
def normalize_kc_comp(comp):
# 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
if 'config' in comp:
# 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
if 'krbPrincipalAttribute' not in comp['config']:
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):
compcopy = deepcopy(comp)