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: - volume:
- /root:/mnt/volume - /root:/mnt/volume
- /var:/test:ro - /var:/test:ro
- health-cmd: curl localhost:80
- health-retries: 10
docker_systemd_service_container_cmd: [] docker_systemd_service_container_cmd: []
#! TO REPLACE #! TO REPLACE
docker_systemd_service_container_labels: [] docker_systemd_service_container_labels: []

View File

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