From 8b09488e3b698147afbf6f40090e7a346ff6a073 Mon Sep 17 00:00:00 2001 From: Donien <88634789+Donien@users.noreply.github.com> Date: Wed, 31 Jul 2024 10:23:12 +0200 Subject: [PATCH] Use double quotes instead of single quotes in ini Within Icinga Web's ini files double quotes are needed to encapsulate certain values. Changed single quotes to double quotes in template. Fixes #301 --- changelogs/fragments/fix_issue_301.yml | 2 ++ roles/icingaweb2/templates/ini_template.j2 | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/fix_issue_301.yml diff --git a/changelogs/fragments/fix_issue_301.yml b/changelogs/fragments/fix_issue_301.yml new file mode 100644 index 00000000..19652485 --- /dev/null +++ b/changelogs/fragments/fix_issue_301.yml @@ -0,0 +1,2 @@ +bugfixes: + - "Certain values within Icinga Web :code:`ini` files got quoted incorrectly using single quotes. They are now quoted properly using double quotes (#301)." diff --git a/roles/icingaweb2/templates/ini_template.j2 b/roles/icingaweb2/templates/ini_template.j2 index 21b44bc2..f5ec9ac5 100644 --- a/roles/icingaweb2/templates/ini_template.j2 +++ b/roles/icingaweb2/templates/ini_template.j2 @@ -7,8 +7,8 @@ {{ option }} = "{{ value }}" {% elif value is iterable and (value is not string and value is not mapping) %} {{ option }} = "{{ value | join(', ') }}" -{% elif ( value is string and ( "=" in value or "!" in value ) )%} -{{ option }} = '{{ value }}' +{% elif ( value is string and ( "=" in value or "!" in value or " " in value ) )%} +{{ option }} = "{{ value }}" {% else %} {{ option }} = {{ value }} {% endif %}