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)