feat(template): test the type of data against list to enable passing integers or strings or lists
All checks were successful
test / Linting (push) Successful in 9s

This commit is contained in:
Bertrand Lanson 2023-12-09 18:20:54 +01:00
parent 2c275b9f1c
commit b466741102
2 changed files with 8 additions and 5 deletions

View File

@ -10,6 +10,9 @@ docker_systemd_service_flags:
- volume:
- /root:/mnt/volume
- /var:/test:ro
- health-cmd: curl localhost:80
- health-retries: 10
docker_systemd_service_container_cmd: []
#! TO REPLACE
docker_systemd_service_container_labels: []

View File

@ -9,13 +9,13 @@
{%- if item is mapping %}
{% set key = item.keys() | first %}
{% set value = item[key] %}
{%- if value is string %}
--{{ key }} {{ value }} \
{%- elif value is iterable %}
{%- if value.__class__.__name__ == 'list' %}
{% for val in value %}
--{{ key }} {{ val }} \{% if not loop.last +%}
--{{ key }} "{{ val }}" \{% if not loop.last +%}
{% endif %}{% endfor %}
{% endif -%}
{%- else %}
--{{ key }} "{{ value }}" \
{%- endif %}
{%- elif item is string %}
--{{ item }} \
{%- endif -%}