Struggling with jinja replace filter

8,280 views
Skip to first unread message

Kevin Dodge

unread,
Nov 30, 2012, 1:15:43 PM11/30/12
to salt-...@googlegroups.com
So looking at this page http://wsgiarea.pocoo.org/jinja/docs/filters.html I should be able to use the jinja filter "replace".   But everytime I try to do this in my .sls files I get this error - "["Rendering SLS glassfish failed, render error:\nexpected token 'end of statement block', got 'string'"]}"
 
Example:

example.sls -- 
{% set filteredString='abcdef'|replace 'a' 'b' %}

salt '*' state.show_sls example

Error:

["Rendering SLS glassfish failed, render error:\nexpected token 'end of statement block', got 'string'"]
 

Kevin Dodge

unread,
Nov 30, 2012, 1:24:41 PM11/30/12
to salt-...@googlegroups.com
Wow, I found the answer to my own problem, and now I feel stupid.  Turns out the link I references is jinja 1.0 documentation.   The proper documentation is here http://jinja.pocoo.org/docs/templates/#builtin-filters

Example:

{% set filteredString='abcdef'|replace('a', 'b') %}

Daniel Fackrell

unread,
Nov 30, 2012, 1:31:13 PM11/30/12
to salt-...@googlegroups.com
I'm not positive that this is the issue, but all the examples on the site seem to be of the form:

{{ value | filter arg1 arg2 }}

It looks like you're trying to use it in a {% %} section, which may not be supported.
Reply all
Reply to author
Forward
0 new messages