Escaping {} in Pillar YAML

9,208 views
Skip to first unread message

Petrus Theron

unread,
Oct 13, 2013, 2:29:38 PM10/13/13
to salt-...@googlegroups.com
How do I escape curly braces, e.g. to render "{word}.com" in Pillar's YAML?

I tried {}{word}.com, ``{``word``}``.com, but neither works.

Best
P.

--

Petrus Theron

unread,
Oct 13, 2013, 2:50:35 PM10/13/13
to salt-...@googlegroups.com
Nevermind, got it working by wrapping the terms in single quotes:
my_variable: '{word}.com'

David Ward

unread,
Jun 28, 2015, 10:43:02 PM6/28/15
to salt-...@googlegroups.com
This doesn't work for me. I tried a back slash and that sort of worked, it didn't error but did create a literally back slash though too.

David Ward

unread,
Jun 28, 2015, 11:10:35 PM6/28/15
to salt-...@googlegroups.com
Ok the solution is to double quote the whole line. This means using a backslash to escape any double quotes in the line. 


Hope this helps others.

Colton Myers

unread,
Jul 14, 2015, 6:28:08 PM7/14/15
to salt-...@googlegroups.com
Thanks for posting your solution, David! Always appreciated!

--
Colton Myers
Platform Engineer, SaltStack
@basepi on Twitter/Github/IRC

--
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.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages