Last active
August 29, 2015 14:23
-
-
Save BrianGallew/bb5dfcdc4ff1dab0e6ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% from "zookeeper/map.jinja" import zookeeper, zookeeper_environment with context %} | |
# [CHOMP lots of other stuff] | |
my_zookeeper_environment: {{ zookeeper_environment }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# map.jinja | |
{% set tags = salt['grains.get']('cornerstone.tags') -%} | |
{% set zookeeper_environment = tags %} | |
{% for my_tag in salt['grains.get']('cornerstone.tags') -%} | |
{% set zookeeper_environment = my_tag -%} | |
{% endfor -%} | |
# init.sls pulls in the map thusly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_zookeeper_environment: ['zookeeper-env-qa-1'] |
# map.jinja
{% set tags = grains['cornerstone.tags'] -%}
{% set zookeeper_environment = tags %}
{% for my_tag in grains['cornerstone.tags'] -%}
{% set zookeeper_environment = my_tag -%}
# init.sls pulls in the map thusly
{% from "zookeeper/map.jinja" import zookeeper, zookeeper_environment with context %}
# and this is how {{ zookeeper_environment }} expands
my_zookeeper_environment: ['zookeeper-env-qa-1']
{% endfor -%}
OK, this is insane. I have another file (zoo.cfg) which is managed. If I change the list at the end to look like this:
server.{{loop.index}}={{servername}}:{{peer_port}}:{{election_port}}
{%- endfor %}
It works as expected.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Per whytewolf, I altered map.jinja to look like this:
The behavior is the same: