FAQ
Nice! That worked.

Just to recap: I had to put single quotes around the values both in the
file.managed state as well as the pillar values themselves.

Thanks for the help!

Ben
On Friday, September 26, 2014 3:48:03 AM UTC-7, Daniel Jagszent wrote:

OK, then pillar['es_node_data'] is already the culprit.
Also add single quotes where you assign 'true' to this pillar value. (and
do not drop the ones from my last message)

YAML does some smart interpretation of the data. Whenever you have the
values "true/false", "True/False", "yes/no" it will convert those to
booleans. When you do not want this to happen you have to use quotes.

Benjamen Keroack <javascript:>
26. September 2014 00:51
This didn't work. The file.replace state immediately afterward still found
and replaced the capitals.

On Thursday, September 25, 2014 1:42:45 AM UTC-7, Daniel Jagszent wrote:
--
You received this message because you are subscribed to the Google Groups
"Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to salt-users+...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/d/optout.
Daniel Jagszent <javascript:>
25. September 2014 10:42
Hello Benjamen,

Benjamen Keroack wrote:
this should work. Maybe you placed the single quotes in the wrong place?
Alex meant putting them here (marked red and underlined for visibility):

# state (partial)
/etc/elasticsearch/elasticsearch.yml:
file.managed:
[...]
- node_data: '{{ pillar['es_node_data'] }}'
- template: jinja




Benjamen Keroack <javascript:>
23. September 2014 00:45
Enclosing the values in single quotes didn't work. true/false are still
coerced to True/False.

This is super annoying. Am I really going to have to do a file.replace to
get rid of the capitals?


On Thursday, September 18, 2014 11:54:56 AM UTC-7, Alex Leonhardt wrote:
--
You received this message because you are subscribed to the Google Groups
"Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to salt-users+...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/d/optout.
Alex Leonhardt <javascript:>
18. September 2014 20:54

You could use single quotes, I guess, which "should" make it a string...

Alex
--
You received this message because you are subscribed to the Google Groups
"Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to salt-users+...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/d/optout.
Benjamen Keroack <javascript:>
18. September 2014 20:47
I'm using pillar to populate a configuration file template with values via
file.managed in a state.

The problem I'm having is that the following pillar value is always
silently converted to a Python boolean value instead of text:

# pillar value
es_node_data: "true"

# state (partial)
/etc/elasticsearch/elasticsearch.yml:
file.managed:
[...]
- node_data: {{ pillar['es_node_data'] }}
- template: jinja

# template file (partial)
node.data: {{ node_data }}

# resulting line in file
# should be
# node.data: true

node.data: True

Somehow the value is being converted to a Python True value somewhere and
this is getting written to the file. This breaks this configuration file
(Elasticsearch) which is case sensitive and requires "true" (not "True").

Any ideas how to fix?

Ben


--
You received this message because you are subscribed to the Google Groups
"Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to salt-users+...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 8 of 8 | next ›
Discussion Overview
groupsalt-users @
postedSep 18, '14 at 6:47p
activeSep 26, '14 at 5:11p
posts8
users4

People

Translate

site design / logo © 2022 Grokbase