From 0e5b0a2e97ac74ed0815adfb8c7c49c86abed0ad Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 17 Jul 2014 09:07:04 -0500 Subject: [PATCH] Revert "Set Jinja2's keep_trailing_newline=True in template_from_string." This reverts commit 7a8eb0b6701e437cb18b9b3a540dbac9aef9db26. --- lib/ansible/utils/template.py | 2 +- test/integration/roles/test_template/tasks/main.yml | 8 +------- test/integration/roles/test_template/vars/main.yml | 2 -- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/ansible/utils/template.py b/lib/ansible/utils/template.py index 4f1e56c7d3..cc1dc7fdeb 100644 --- a/lib/ansible/utils/template.py +++ b/lib/ansible/utils/template.py @@ -322,7 +322,7 @@ def template_from_string(basedir, data, vars, fail_on_undefined=False): def my_finalize(thing): return thing if thing is not None else '' - environment = jinja2.Environment(trim_blocks=True, keep_trailing_newline=True, undefined=StrictUndefined, extensions=_get_extensions(), finalize=my_finalize) + environment = jinja2.Environment(trim_blocks=True, undefined=StrictUndefined, extensions=_get_extensions(), finalize=my_finalize) environment.filters.update(_get_filters()) environment.template_class = J2Template diff --git a/test/integration/roles/test_template/tasks/main.yml b/test/integration/roles/test_template/tasks/main.yml index 8dcb0b47cf..4784dc6ac8 100644 --- a/test/integration/roles/test_template/tasks/main.yml +++ b/test/integration/roles/test_template/tasks/main.yml @@ -63,10 +63,4 @@ assert: that: - "file_result.changed != True" - -# VERIFY STRING TEMPLATE PRESERVES NEWLINE - -- name: ensure template strings preserve newline - assert: - that: - - "newline_no_template_string == newline_template_string" + diff --git a/test/integration/roles/test_template/vars/main.yml b/test/integration/roles/test_template/vars/main.yml index 88503a22ca..1e8f64ccf4 100644 --- a/test/integration/roles/test_template/vars/main.yml +++ b/test/integration/roles/test_template/vars/main.yml @@ -1,3 +1 @@ templated_var: templated_var_loaded -newline_template_string: "Hello {{ 'World' }}\n" -newline_no_template_string: "Hello World\n"