Browse Source

Use a separate task for validating `matrix_bot_draupnir_admin_api_enabled` when `matrix_bot_draupnir_config_admin_enableMakeRoomAdminCommand`

The other task deals with checking for null and not-blank and can't handle booleans properly.
pull/3389/head
Slavi Pantaleev 1 year ago
committed by GitHub
parent
commit
5e5019f502
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      roles/custom/matrix-bot-draupnir/tasks/validate_config.yml

+ 5
- 1
roles/custom/matrix-bot-draupnir/tasks/validate_config.yml View File

@@ -37,9 +37,13 @@
- {'name': 'matrix_bot_draupnir_config_rawHomeserverUrl', when: true} - {'name': 'matrix_bot_draupnir_config_rawHomeserverUrl', when: true}
- {'name': 'matrix_bot_draupnir_pantalaimon_username', when: "{{ matrix_bot_draupnir_pantalaimon_use }}"} - {'name': 'matrix_bot_draupnir_pantalaimon_username', when: "{{ matrix_bot_draupnir_pantalaimon_use }}"}
- {'name': 'matrix_bot_draupnir_pantalaimon_password', when: "{{ matrix_bot_draupnir_pantalaimon_use }}"} - {'name': 'matrix_bot_draupnir_pantalaimon_password', when: "{{ matrix_bot_draupnir_pantalaimon_use }}"}
- {'name': 'matrix_bot_draupnir_admin_api_enabled', when: "{{ matrix_bot_draupnir_config_admin_enableMakeRoomAdminCommand }}"}
when: "item.when | bool and (vars[item.name] == '' or vars[item.name] is none)" when: "item.when | bool and (vars[item.name] == '' or vars[item.name] is none)"


- name: Fail if Draupnir room hijacking enabled without enabling the Synapse Admin API
ansible.builtin.fail:
msg: "When matrix_bot_draupnir_config_admin_enableMakeRoomAdminCommand is enabled, matrix_bot_draupnir_admin_api_enabled must also be enabled"
when: "matrix_bot_draupnir_config_admin_enableMakeRoomAdminCommand | bool and not matrix_bot_draupnir_admin_api_enabled | bool"

- name: Fail if inappropriate variables are defined - name: Fail if inappropriate variables are defined
ansible.builtin.fail: ansible.builtin.fail:
msg: "The `{{ item.name }}` variable must be undefined or have a null value." msg: "The `{{ item.name }}` variable must be undefined or have a null value."


Loading…
Cancel
Save