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

Jninja error generating icingaweb2 where some values are numeric #285

Open
sol1-matt opened this issue May 17, 2024 · 0 comments · May be fixed by #287
Open

Jninja error generating icingaweb2 where some values are numeric #285

sol1-matt opened this issue May 17, 2024 · 0 comments · May be fixed by #287

Comments

@sol1-matt
Copy link

Ansible version: 2.16.4
Jinja version 3.0.3
Latest galaxy version of collection

Error

The icingaweb2 ini configuration fails with the following error

failed: [icingawebhost] (item=config) => {
  "ansible_loop_var": "item", 
  "changed": false, 
  "item": "config", 
  "msg": "AnsibleError: Unexpected templating type error occurred on ({% import 'ini_template.j2' as ini_template %}\n{{ ini_template.generate_ini(_i2_config_hash) -}}\n): sequence item 5: expected str instance, int found. sequence item 5: expected str instance, int found"
}

Cause

The problem is in roles/icingaweb2/templates/ini_template.j2 line 7

{% if value is number %}
{{ option }} = "{{ value }}"

Solution

casting the value to a string fixes the problem

{% if value is number %}
{{ option }} = "{{ value | string }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant