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

Keycloak: Fix bug on keycloak_authentication, requirement not always updated (#3330)

* Fix diff mode when updating authentication flow with keycloak_authentication module

* Update documentation of create_or_update_executions function (return tuple instead of dict)

* Fix: Update requirement when new exex created

* Add changelog fragment

* Update changelogs/fragments/3330-bugfix-keycloak-authentication-flow-requirements-not-set-correctly.yml.yml

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

* Update changelogs/fragments/3330-bugfix-keycloak-authentication-flow-requirements-not-set-correctly.yml.yml

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

* Edit requirement of sublow

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Gaetan2907 2021-09-26 13:30:29 +02:00 committed by GitHub
parent 3715b6ef46
commit 147ca2fe66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -0,0 +1,3 @@
bugfixes:
- keycloak_authentication - fix bug, the requirement was always on ``DISABLED`` when creating a new authentication flow
(https://github.com/ansible-collections/community.general/pull/3330).

View file

@ -195,7 +195,6 @@ def create_or_update_executions(kc, config, realm='master'):
:param kc: Keycloak API access. :param kc: Keycloak API access.
:param config: Representation of the authentication flow including it's executions. :param config: Representation of the authentication flow including it's executions.
:param realm: Realm :param realm: Realm
:return: True if executions have been modified. False otherwise.
:return: tuple (changed, dict(before, after) :return: tuple (changed, dict(before, after)
WHERE WHERE
bool changed indicates if changes have been made bool changed indicates if changes have been made
@ -235,10 +234,14 @@ def create_or_update_executions(kc, config, realm='master'):
elif new_exec["providerId"] is not None: elif new_exec["providerId"] is not None:
kc.create_execution(new_exec, flowAlias=flow_alias_parent, realm=realm) kc.create_execution(new_exec, flowAlias=flow_alias_parent, realm=realm)
exec_found = True exec_found = True
exec_index = new_exec_index
id_to_update = kc.get_executions_representation(config, realm=realm)[exec_index]["id"]
after += str(new_exec) + '\n' after += str(new_exec) + '\n'
elif new_exec["displayName"] is not None: elif new_exec["displayName"] is not None:
kc.create_subflow(new_exec["displayName"], flow_alias_parent, realm=realm) kc.create_subflow(new_exec["displayName"], flow_alias_parent, realm=realm)
exec_found = True exec_found = True
exec_index = new_exec_index
id_to_update = kc.get_executions_representation(config, realm=realm)[exec_index]["id"]
after += str(new_exec) + '\n' after += str(new_exec) + '\n'
if exec_found: if exec_found:
changed = True changed = True