From 3af3ef48fce1a7f738e3ce4f315836f6b89f8a67 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Fri, 25 May 2018 13:15:17 +0300 Subject: [PATCH] Make .log.config modifications respect whitespace A `.log.config` file may be generated with a different level of indentation depending on which (Docker image, etc.) generates it. With this patch, we tolerate different levels of indentation (2 spaces, 4 spaces, etc.) and don't break the configuration. --- roles/matrix-server/tasks/setup_synapse.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/roles/matrix-server/tasks/setup_synapse.yml b/roles/matrix-server/tasks/setup_synapse.yml index 2c67a6767..6a8898a37 100644 --- a/roles/matrix-server/tasks/setup_synapse.yml +++ b/roles/matrix-server/tasks/setup_synapse.yml @@ -61,10 +61,11 @@ args: regexp: "{{ item.regexp }}" line: '{{ item.line }}' + backrefs: '{{ item.backrefs }}' with_items: - - {"regexp": "^ filename:", "line": ' filename: /matrix-run/homeserver.log'} - - {"regexp": "^ maxBytes:", "line": ' maxBytes: {{ matrix_max_log_file_size_mb * 1024 * 1024 }}'} - - {"regexp": "^ backupCount:", "line": ' backupCount: {{ matrix_max_log_files_count }}'} + - {"regexp": '^(\s+)filename:', "line": '\1filename: /matrix-run/homeserver.log', backrefs: yes} + - {"regexp": '^(\s+)maxBytes:', "line": '\1maxBytes: {{ matrix_max_log_file_size_mb * 1024 * 1024 }}', backrefs: yes} + - {"regexp": '^(\s+)backupCount:', "line": '\1backupCount: {{ matrix_max_log_files_count }}', backrefs: yes} - name: Augment Matrix config lineinfile: "dest={{ matrix_synapse_config_dir_path }}/homeserver.yaml"