From 74bb81273950e978c01b8b2f610217b9815575b8 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Thu, 4 Jul 2024 13:56:47 +0300 Subject: [PATCH] Revert "Make use of the new --exists-ok flag for register_new_matrix_user" This reverts commit 752de4406eaeafa89cd208efaa9dc3ac03daa2f2. Fixes https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/3393 When running the playbook against an existing server, it invokes `register_new_matrix_user` as part of the `matrix-user-creator` role, which runs before the `systemd_service_manager`. At that time, `matrix-user-creator` detects that Synapse is up (from before), but it's the old version. Services have not yet been restarted, so it's actually the older Synapse version that is up, not the new one. The old version does not support the `--exists-ok` flag yet. Basically, this `--exists-ok` patch landed too early and has affected existing playbook users that have an older version of Synapse in operation. It will be safer to bring back this patch some time in the future. However, users upgrading from Synapse <= v1.109.0 even long into the future will bump into the same issue. As such, it would be better to either add special handling or to delay bringing back this patch enough so as to ensure everyone using the playbook is on Synapse >= 1.110.0. --- .../tasks/util/ensure_user_registered_synapse.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/custom/matrix-user-creator/tasks/util/ensure_user_registered_synapse.yml b/roles/custom/matrix-user-creator/tasks/util/ensure_user_registered_synapse.yml index 753573415..00189e5c5 100644 --- a/roles/custom/matrix-user-creator/tasks/util/ensure_user_registered_synapse.yml +++ b/roles/custom/matrix-user-creator/tasks/util/ensure_user_registered_synapse.yml @@ -16,7 +16,7 @@ --user_type={{ user.initial_type | quote }} {% endif %} {% endif %} - --exists-ok http://localhost:{{ matrix_synapse_container_client_api_port }} register: matrix_synapse_register_user_result - changed_when: matrix_synapse_register_user_result.rc == 0 and 'User already exists' not in matrix_synapse_register_user_result.stdout + changed_when: matrix_synapse_register_user_result.rc == 0 and 'User ID already taken' not in matrix_synapse_register_user_result.stdout + failed_when: matrix_synapse_register_user_result.rc != 0 and 'User ID already taken' not in matrix_synapse_register_user_result.stdout