From 5d9a7ab2400badc11a236c86076affa4327acb72 Mon Sep 17 00:00:00 2001 From: fgruenbauer Date: Thu, 3 Oct 2024 14:38:09 +0200 Subject: [PATCH] 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 --- ...-federation-remove-lastSync-param-from-kc-responses.yml | 2 ++ plugins/modules/keycloak_user_federation.py | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/8812-keycloak-user-federation-remove-lastSync-param-from-kc-responses.yml diff --git a/changelogs/fragments/8812-keycloak-user-federation-remove-lastSync-param-from-kc-responses.yml b/changelogs/fragments/8812-keycloak-user-federation-remove-lastSync-param-from-kc-responses.yml new file mode 100644 index 0000000000..82496d1083 --- /dev/null +++ b/changelogs/fragments/8812-keycloak-user-federation-remove-lastSync-param-from-kc-responses.yml @@ -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). \ No newline at end of file diff --git a/plugins/modules/keycloak_user_federation.py b/plugins/modules/keycloak_user_federation.py index 06283a025e..0b3b610806 100644 --- a/plugins/modules/keycloak_user_federation.py +++ b/plugins/modules/keycloak_user_federation.py @@ -722,12 +722,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)