How should brackets around braces be escaped?

Hi.

I’m having some trouble getting a fragment of a group_vars/all file to pass syntax checking. I’m on the latest github code at the time of writing (daf6eb97d3b0d059e0856015b2eb62d32281b9ad).

Here’s a minimal example similar to what I need in the group_vars file:

`
my_env: dev
env_upper_bracketed: “[{{ my_env | upper }}]”
username: “{{ env_upper_bracketed }} user”

`

This throws the warnings

`
[WARNING]: Exception in safe_eval() on expr: [DEV] (name ‘DEV’ is not defined)


[WARNING]: SyntaxError in safe_eval() on expr: [DEV] user (unexpected EOF while parsing
(, line 1))
`

I would expect the string “[DEV]” to be the value of env_upper_bracketed, and for username to be set to “[DEV] user”, but it seems like the parser disagrees. Single quoting the brackets isn’t really a workaround, since the single quotes then become part of the value of env_upper_bracketed. Backslash escaping is only allowed for non-printable characters so that’s not an option either.

Any suggestions for what I’m doing wrong, or did I hit an edge case bug in the parser?

Just tried it with 2.1.1, no error and debug give me this
TASK [debug]