1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-03-22 05:09:12 +00:00

keycloak_authentication: fix TypeError when flow has no authenticationExecutions (#11548)

* TIAAS-12174: fix(keycloak_authentication): handle None authenticationExecutions

When a flow is defined without authenticationExecutions, module.params.get()
returns None but the key still exists in the config dict. The 'in' check
passes but iterating over None raises TypeError.

Guard the iteration with an explicit None check.

* keycloak_authentication: add changelog fragment for NoneType fix

* keycloak_authentication: update changelog fragment with PR link

* Update plugins/modules/keycloak_authentication.py

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

* Changelog polishing

---------

Co-authored-by: Ivan Kokalovic <ivan.kokalovic@example.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Ivan Kokalovic 2026-03-10 06:48:06 +01:00 committed by GitHub
parent 93112d23e5
commit 2f33ff1041
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
bugfixes:
- keycloak_authentication - fix ``TypeError`` crash when a flow is defined without
``authenticationExecutions``
(https://github.com/ansible-collections/community.general/issues/11547,
https://github.com/ansible-collections/community.general/pull/11548).

View file

@ -273,7 +273,7 @@ def create_or_update_executions(kc, config, realm="master"):
after = "" after = ""
before = "" before = ""
execution = None execution = None
if "authenticationExecutions" in config: if config.get("authenticationExecutions") is not None:
# Get existing executions on the Keycloak server for this alias # Get existing executions on the Keycloak server for this alias
existing_executions = kc.get_executions_representation(config, realm=realm) existing_executions = kc.get_executions_representation(config, realm=realm)
for new_exec_index, new_exec in enumerate(config["authenticationExecutions"], start=0): for new_exec_index, new_exec in enumerate(config["authenticationExecutions"], start=0):