[PR #9976/04137746 backport][stable-9] keycloak_client: fix idempotency regression (#9996)
Some checks failed
EOL CI / EOL Sanity (Ⓐ2.13) (push) Has been cancelled
EOL CI / EOL Sanity (Ⓐ2.14) (push) Has been cancelled
EOL CI / EOL Sanity (Ⓐ2.15) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.13+py2.7) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.13+py3.8) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.14+py3.9) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py3.10) (push) Has been cancelled
EOL CI / EOL Units (Ⓐ2.15+py3.5) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.13+alpine3+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.13+alpine3+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.13+alpine3+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.13+fedora35+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.13+fedora35+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.13+fedora35+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.13+opensuse15py2+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.13+opensuse15py2+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.13+opensuse15py2+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.14+alpine3+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.14+alpine3+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.14+alpine3+py:azp/posix/3/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/1/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/2/) (push) Has been cancelled
EOL CI / EOL I (Ⓐ2.15+fedora37+py:azp/posix/3/) (push) Has been cancelled
import-galaxy / Test to import built collection artifact with Galaxy importer (push) Has been cancelled
Verify REUSE / check (push) Has been cancelled

keycloak_client: fix idempotency regression (#9976)

* add function to normalize kc responses

* add changelog fragment

* Update changelogs/fragments/9976-keycloak_client-fix-idempotency-regression.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* add newline to changelog fragment

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 0413774641)

Co-authored-by: gruenbauer@b1-systems.de <gruenbauer@b1-systems.de>
This commit is contained in:
patchback[bot] 2025-04-14 22:51:06 +02:00 committed by GitHub
parent 69cb9b7578
commit 69590f55ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 4 deletions

View file

@ -837,6 +837,13 @@ def normalise_cr(clientrep, remove_ids=False):
return clientrep
def normalize_kc_resp(clientrep):
# kc drops the variable 'authorizationServicesEnabled' if set to false
# to minimize diff/changes we set it to false if not set by kc
if clientrep and 'authorizationServicesEnabled' not in clientrep:
clientrep['authorizationServicesEnabled'] = False
def sanitize_cr(clientrep):
""" Removes probably sensitive details from a client representation.
@ -1026,10 +1033,7 @@ def main():
else:
before_client = kc.get_client_by_id(cid, realm=realm)
# kc drops the variable 'authorizationServicesEnabled' if set to false
# to minimize diff/changes we set it to false if not set by kc
if before_client and 'authorizationServicesEnabled' not in before_client:
before_client['authorizationServicesEnabled'] = False
normalize_kc_resp(before_client)
if before_client is None:
before_client = {}
@ -1110,6 +1114,8 @@ def main():
kc.update_client(cid, desired_client, realm=realm)
after_client = kc.get_client_by_id(cid, realm=realm)
normalize_kc_resp(after_client)
if before_client == after_client:
result['changed'] = False
if module._diff: