From 6085e3a8163cb497ed27e1002d5cd02438a736fe Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Fri, 3 Mar 2023 10:37:51 +0200 Subject: [PATCH] Add validation tasks for Etherpad migration (matrix_etherpad -> etherpad) --- .../matrix_playbook_migration/defaults/main.yml | 3 +++ .../tasks/validate_config.yml | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/roles/custom/matrix_playbook_migration/defaults/main.yml b/roles/custom/matrix_playbook_migration/defaults/main.yml index 514125ec0..dbc3b3b86 100644 --- a/roles/custom/matrix_playbook_migration/defaults/main.yml +++ b/roles/custom/matrix_playbook_migration/defaults/main.yml @@ -17,3 +17,6 @@ matrix_playbook_migration_matrix_ntfy_migration_validation_enabled: true # Controls if (`matrix_redis` -> `redis`) validation will run. matrix_playbook_migration_matrix_redis_migration_validation_enabled: true + +# Controls if (`matrix_etherpad` -> `etherpad`) validation will run. +matrix_playbook_migration_matrix_etherpad_migration_validation_enabled: true diff --git a/roles/custom/matrix_playbook_migration/tasks/validate_config.yml b/roles/custom/matrix_playbook_migration/tasks/validate_config.yml index 2241d5023..296f2dafb 100644 --- a/roles/custom/matrix_playbook_migration/tasks/validate_config.yml +++ b/roles/custom/matrix_playbook_migration/tasks/validate_config.yml @@ -141,3 +141,18 @@ Please change your configuration (vars.yml) to rename all variables (`matrix_redis_` -> `redis_`). We found usage of the following variables: {{ matrix_playbook_migration_redis_migration_vars.keys() | join(', ') }} when: "matrix_playbook_migration_redis_migration_vars | length > 0" + +- when: matrix_playbook_migration_matrix_etherpad_migration_validation_enabled | bool + block: + - ansible.builtin.set_fact: + matrix_playbook_migration_etherpad_migration_vars: |- + {{ vars | dict2items | selectattr('key', 'match', 'matrix_etherpad_.*') | list | items2dict }} + + - name: (Deprecation) Catch and report matrix_etherpad variables + ansible.builtin.fail: + msg: >- + The matrix-etherpad role that used to be part of this playbook has been replaced by https://gitlab.com/etke.cc/roles/etherpad. + The new role is compatible with the old one, but uses different names for its variables. + Please change your configuration (vars.yml) to rename all variables (`matrix_etherpad_` -> `etherpad_`). + We found usage of the following variables: {{ matrix_playbook_migration_etherpad_migration_vars.keys() | join(', ') }} + when: "matrix_playbook_migration_etherpad_migration_vars | length > 0"