Add the template lookup escaping to the 2.4 porting guide (#32760)
* Add the template lookup escaping to the 2.4 porting guide
This commit is contained in:
parent
5625720c64
commit
faa74a8ccd
1 changed files with 26 additions and 0 deletions
|
@ -131,6 +131,32 @@ Developers:
|
||||||
* Any callbacks inheriting from other callbacks might need to also be updated to contain the same documented options
|
* Any callbacks inheriting from other callbacks might need to also be updated to contain the same documented options
|
||||||
as the parent or the options won't be available. This is noted in the developer guide.
|
as the parent or the options won't be available. This is noted in the developer guide.
|
||||||
|
|
||||||
|
Template lookup plugin: Escaping Strings
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
Prior to Ansible 2.4, backslashes in strings passed to the template lookup plugin would be escaped
|
||||||
|
automatically. In 2.4, users are responsible for escaping backslashes themselves. This change
|
||||||
|
brings the template lookup plugin inline with the template module so that the same backslash
|
||||||
|
escaping rules apply to both.
|
||||||
|
|
||||||
|
If you have a template lookup like this::
|
||||||
|
|
||||||
|
- debug:
|
||||||
|
msg: '{{ lookup("template", "template.j2") }}'
|
||||||
|
|
||||||
|
**OLD** In Ansible 2.3 (and earlier) :file:`template.j2` would look like this:
|
||||||
|
|
||||||
|
.. code-block:: jinja
|
||||||
|
|
||||||
|
{{ "name surname" | regex_replace("^[^\s]+\s+(.*)", "\1") }}
|
||||||
|
|
||||||
|
**NEW** In Ansible 2.4 it should be changed to look like this:
|
||||||
|
|
||||||
|
.. code-block:: jinja
|
||||||
|
|
||||||
|
{{ "name surname" | regex_replace("^[^\\s]+\\s+(.*)", "\\1") }}
|
||||||
|
|
||||||
|
|
||||||
Networking
|
Networking
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue