Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use double quotes instead of single quotes in ini #312

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/fix_issue_301.yml
Original file line number Diff line number Diff line change
@@ -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)."
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ def test_advanced_filter(host):
i2_file = host.file("/tmp/advanced_filter")
print(i2_file.content_string)
assert i2_file.is_file
assert i2_file.content_string == "\n[section]\ntest = '!(objectClass=user)'\ntest2 = '!(objectClass=user)'\ntest3 = '!attribute'\n"
assert i2_file.content_string == '\n[section]\ntest = "!(objectClass=user)"\ntest2 = "!(objectClass=user)"\ntest3 = "!attribute"\n'

def test_equal_sign(host):
i2_file = host.file("/tmp/equal_sign")
print(i2_file.content_string)
assert i2_file.is_file
assert i2_file.content_string == "\n[section]\ntest = 'equal=sign'\n"
assert i2_file.content_string == '\n[section]\ntest = "equal=sign"\n'
4 changes: 2 additions & 2 deletions roles/icingaweb2/templates/ini_template.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
Loading