diff --git a/changelogs/fragments/3330-bugfix-keycloak-authentication-flow-requirements-not-set-correctly.yml.yml b/changelogs/fragments/3330-bugfix-keycloak-authentication-flow-requirements-not-set-correctly.yml.yml new file mode 100644 index 0000000000..bcd2e594d7 --- /dev/null +++ b/changelogs/fragments/3330-bugfix-keycloak-authentication-flow-requirements-not-set-correctly.yml.yml @@ -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). diff --git a/plugins/modules/identity/keycloak/keycloak_authentication.py b/plugins/modules/identity/keycloak/keycloak_authentication.py index 8a33409b58..5a48eab2ce 100644 --- a/plugins/modules/identity/keycloak/keycloak_authentication.py +++ b/plugins/modules/identity/keycloak/keycloak_authentication.py @@ -195,7 +195,6 @@ def create_or_update_executions(kc, config, realm='master'): :param kc: Keycloak API access. :param config: Representation of the authentication flow including it's executions. :param realm: Realm - :return: True if executions have been modified. False otherwise. :return: tuple (changed, dict(before, after) WHERE 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: kc.create_execution(new_exec, flowAlias=flow_alias_parent, realm=realm) 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' elif new_exec["displayName"] is not None: kc.create_subflow(new_exec["displayName"], flow_alias_parent, realm=realm) 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' if exec_found: changed = True