1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[PR #8831/2ae41fa8 backport][stable-9] keycloak_user_federation: get the before mappers from before_comp to fix UnboundLocalError (#8850)

keycloak_user_federation: get the before mappers from `before_comp` to fix `UnboundLocalError` (#8831)

* fix: get the before mappers from `before_comp`

* add changelog fragment

* Adjust changelog fragment.

---------

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

Co-authored-by: fgruenbauer <gruenbauer@b1-systems.de>
This commit is contained in:
patchback[bot] 2024-09-09 12:17:13 +00:00 committed by GitHub
parent 5f7a3ac896
commit 8d8fc3d3ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- keycloak_user_federation - fix the ``UnboundLocalError`` that occurs when an ID is provided for a user federation mapper (https://github.com/ansible-collections/community.general/pull/8831).

View file

@ -907,7 +907,7 @@ def main():
if cid is None: if cid is None:
old_mapper = {} old_mapper = {}
elif change.get('id') is not None: elif change.get('id') is not None:
old_mapper = next((before_mapper for before_mapper in before_mapper.get('mappers', []) if before_mapper["id"] == change['id']), None) old_mapper = next((before_mapper for before_mapper in before_comp.get('mappers', []) if before_mapper["id"] == change['id']), None)
if old_mapper is None: if old_mapper is None:
old_mapper = {} old_mapper = {}
else: else: