summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/template/templates
diff options
context:
space:
mode:
authorZac Medico <zmedico@gmail.com>2017-08-10 00:50:53 +0200
committerBrian Coca <bcoca@users.noreply.github.com>2017-08-10 00:50:53 +0200
commit501fc7a248c4ad09c2593a200b3fbbdff0e48c70 (patch)
treeee1c8a420d8ffb9af7dc5664b82025902041009b /test/integration/targets/template/templates
parentVarious small changes and adding myself (diff)
downloadansible-501fc7a248c4ad09c2593a200b3fbbdff0e48c70.tar.xz
ansible-501fc7a248c4ad09c2593a200b3fbbdff0e48c70.zip
template: fix KeyError: 'undefined variable: 0 (#27972)
* template: fix KeyError: 'undefined variable: 0 For compatibility with the Context.get_all() implementation in jinja 2.9, make AnsibleJ2Vars implement collections.Mapping. Also, make AnsibleJ2Template.newcontext() handle dict type for the 'vars' parameter. See: https://github.com/pallets/jinja/commit/d67f0fd4cc2a4af08f51f4466150d49da7798729 Fixes: https://github.com/ansible/ansible/issues/20494 * add units/template/test_vars * intg tests for jinja-2.9 issues like 20494 test cases here are based on https://github.com/ansible/ansible/issues/20494#issue-202108318
Diffstat (limited to 'test/integration/targets/template/templates')
-rw-r--r--test/integration/targets/template/templates/bar1
-rw-r--r--test/integration/targets/template/templates/import_as.j24
-rw-r--r--test/integration/targets/template/templates/import_as_with_context.j23
-rw-r--r--test/integration/targets/template/templates/import_as_with_context.js3
-rw-r--r--test/integration/targets/template/templates/import_with_context.j24
-rw-r--r--test/integration/targets/template/templates/qux1
6 files changed, 16 insertions, 0 deletions
diff --git a/test/integration/targets/template/templates/bar b/test/integration/targets/template/templates/bar
new file mode 100644
index 0000000000..2b60207f03
--- /dev/null
+++ b/test/integration/targets/template/templates/bar
@@ -0,0 +1 @@
+Goodbye
diff --git a/test/integration/targets/template/templates/import_as.j2 b/test/integration/targets/template/templates/import_as.j2
new file mode 100644
index 0000000000..b06f1be849
--- /dev/null
+++ b/test/integration/targets/template/templates/import_as.j2
@@ -0,0 +1,4 @@
+{% import 'qux' as qux %}
+hello world import as
+{{ qux.wibble }}
+{% include 'bar' %}
diff --git a/test/integration/targets/template/templates/import_as_with_context.j2 b/test/integration/targets/template/templates/import_as_with_context.j2
new file mode 100644
index 0000000000..3dd806a35b
--- /dev/null
+++ b/test/integration/targets/template/templates/import_as_with_context.j2
@@ -0,0 +1,3 @@
+{% import 'qux' as qux with context %}
+hello world as qux with context
+{{ qux.wibble }}
diff --git a/test/integration/targets/template/templates/import_as_with_context.js b/test/integration/targets/template/templates/import_as_with_context.js
new file mode 100644
index 0000000000..3dd806a35b
--- /dev/null
+++ b/test/integration/targets/template/templates/import_as_with_context.js
@@ -0,0 +1,3 @@
+{% import 'qux' as qux with context %}
+hello world as qux with context
+{{ qux.wibble }}
diff --git a/test/integration/targets/template/templates/import_with_context.j2 b/test/integration/targets/template/templates/import_with_context.j2
new file mode 100644
index 0000000000..104e68b347
--- /dev/null
+++ b/test/integration/targets/template/templates/import_with_context.j2
@@ -0,0 +1,4 @@
+{% import 'qux' as qux with context %}
+hello world with context
+{{ qux.wibble }}
+{% include 'bar' %}
diff --git a/test/integration/targets/template/templates/qux b/test/integration/targets/template/templates/qux
new file mode 100644
index 0000000000..d8cd22e41a
--- /dev/null
+++ b/test/integration/targets/template/templates/qux
@@ -0,0 +1 @@
+{% set wibble = "WIBBLE" %}