Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save disaster123/b31a0895c0f87a71c30879f07acdd9f3 to your computer and use it in GitHub Desktop.
Save disaster123/b31a0895c0f87a71c30879f07acdd9f3 to your computer and use it in GitHub Desktop.
minitest.sls
{%- set users = ['a', 'b'] -%}
{%- set keys = [1, 2, 3] -%}
{%- for user in users -%}
{%- for key in keys -%}
{{user}} {{key}}
{% endfor -%}
{%- endfor -%}
[DEBUG ] Rendered data from file: /var/cache/salt/minion/files/base/minitest.sls:
a 1
a 2
a 3
b 1
b 2
b 3
[DEBUG ] Results of YAML rendering:
@disaster123
Copy link
Author

This one works as expected:

cat minitest.sls

{%- set users = ['a', 'b'] -%}
{%- set keys = [1, 2, 3] -%}
{%- for user in users -%}
{%- for key in keys -%}
{{user}} {{key}}
{% endfor -%}
{%- endfor -%}

A
[DEBUG   ] Rendered data from file: /var/cache/salt/minion/files/base/minitest.sls:
a 1
a 2
a 3
b 1
b 2
b 3
A

[DEBUG   ] Results of YAML rendering: 

No unexpected newlines and also the newlines after b 3 got correctly removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment