From e1274a6e56ea3e06284b2867a76d951276c160c8 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 31 Oct 2022 21:52:01 +0200 Subject: [PATCH] Rename variable (matrix_hookshot_feeds_interval -> matrix_hookshot_feeds_pollIntervalSeconds) This is more consistent with how we name variables. It's also less confusing, especially given that we have `matrix_hookshot_feeds_pollTimeoutSeconds` as well. --- roles/matrix-bridge-hookshot/defaults/main.yml | 3 +-- roles/matrix-bridge-hookshot/tasks/validate_config.yml | 9 +++++++++ roles/matrix-bridge-hookshot/templates/config.yml.j2 | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/roles/matrix-bridge-hookshot/defaults/main.yml b/roles/matrix-bridge-hookshot/defaults/main.yml index 775ef087..96781f9a 100644 --- a/roles/matrix-bridge-hookshot/defaults/main.yml +++ b/roles/matrix-bridge-hookshot/defaults/main.yml @@ -129,8 +129,7 @@ matrix_hookshot_generic_user_id_prefix: '_webhooks_' matrix_hookshot_feeds_enabled: true -# polling interval in seconds -matrix_hookshot_feeds_interval: 600 +matrix_hookshot_feeds_pollIntervalSeconds: 600 matrix_hookshot_feeds_pollTimeoutSeconds: 10 diff --git a/roles/matrix-bridge-hookshot/tasks/validate_config.yml b/roles/matrix-bridge-hookshot/tasks/validate_config.yml index 0fbcf53c..3392f1b6 100644 --- a/roles/matrix-bridge-hookshot/tasks/validate_config.yml +++ b/roles/matrix-bridge-hookshot/tasks/validate_config.yml @@ -58,6 +58,15 @@ with_items: - "matrix_hookshot_provisioning_secret" +- name: (Deprecation) Catch and report renamed Hookshot variables + ansible.builtin.fail: + msg: >- + Your configuration contains a variable, which now has a different name. + Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). + when: "item.old in vars" + with_items: + - {'old': 'matrix_hookshot_feeds_interval', 'new': 'matrix_hookshot_feeds_pollIntervalSeconds'} + - name: (Deprecation) Catch and report old metrics usage ansible.builtin.fail: msg: >- diff --git a/roles/matrix-bridge-hookshot/templates/config.yml.j2 b/roles/matrix-bridge-hookshot/templates/config.yml.j2 index fb029efd..527afafa 100644 --- a/roles/matrix-bridge-hookshot/templates/config.yml.j2 +++ b/roles/matrix-bridge-hookshot/templates/config.yml.j2 @@ -82,8 +82,8 @@ generic: feeds: # (Optional) Configure this to enable RSS/Atom feed support # - enabled: {{ matrix_hookshot_feeds_enabled }} - pollIntervalSeconds: {{ matrix_hookshot_feeds_interval }} + enabled: {{ matrix_hookshot_feeds_enabled | to_json }} + pollIntervalSeconds: {{ matrix_hookshot_feeds_pollIntervalSeconds | to_json }} pollTimeoutSeconds: {{ matrix_hookshot_feeds_pollTimeoutSeconds | to_json }} {% endif %} {% if matrix_hookshot_provisioning_enabled %}