summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2017-11-12 14:01:14 -0800
committerToshio Kuratomi <a.badger@gmail.com>2017-11-12 14:02:03 -0800
commitb702687f39e1c2008af9054c7b610a805d7ef485 (patch)
treecc3be24ed8d06defbbd6016bbfb64e40c576e2ae
parent52d2245b265800fa91a933c836df260f943911b4 (diff)
downloadansible-b702687f39e1c2008af9054c7b610a805d7ef485.tar.gz
Add the template lookup escaping to the 2.4 porting guide (#32760)
* Add the template lookup escaping to the 2.4 porting guide (cherry picked from commit faa74a8ccd69600f678723734aef7fbae8e60c1a)
-rw-r--r--docs/docsite/rst/porting_guide_2.4.rst26
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/docsite/rst/porting_guide_2.4.rst b/docs/docsite/rst/porting_guide_2.4.rst
index 3266092d79..f52c82335f 100644
--- a/docs/docsite/rst/porting_guide_2.4.rst
+++ b/docs/docsite/rst/porting_guide_2.4.rst
@@ -131,6 +131,32 @@ Developers:
* 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.
+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
==========