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
All checks were successful
test / Linting (push) Successful in 9s
This commit is contained in:
parent
2c275b9f1c
commit
b466741102
@ -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: []
|
||||
|
@ -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 -%}
|
||||
|
Loading…
Reference in New Issue
Block a user