summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <toshio@fedoraproject.org>2015-04-30 09:23:57 -0700
committerToshio Kuratomi <toshio@fedoraproject.org>2015-04-30 09:24:51 -0700
commit8d0ceeca910894ee4f53ab452cd519b555d7b9e3 (patch)
tree0884b81d5468b79aa6f9335fe2fead5db58cb501
parentaafda44bb397ff516a5b43c04c837fdc083b9ac5 (diff)
downloadansible-8d0ceeca910894ee4f53ab452cd519b555d7b9e3.tar.gz
Make template test work with both py2.6 and 2.7+
-rw-r--r--test/integration/roles/test_template/files/foo-py26.txt8
-rw-r--r--test/integration/roles/test_template/files/foo.txt6
-rw-r--r--test/integration/roles/test_template/tasks/main.yml10
3 files changed, 21 insertions, 3 deletions
diff --git a/test/integration/roles/test_template/files/foo-py26.txt b/test/integration/roles/test_template/files/foo-py26.txt
new file mode 100644
index 0000000000..84279bc7b3
--- /dev/null
+++ b/test/integration/roles/test_template/files/foo-py26.txt
@@ -0,0 +1,8 @@
+templated_var_loaded
+
+{
+ "bool": true,
+ "multi_part": "1Foo",
+ "number": 5,
+ "string_num": "5"
+}
diff --git a/test/integration/roles/test_template/files/foo.txt b/test/integration/roles/test_template/files/foo.txt
index 84279bc7b3..edd704da04 100644
--- a/test/integration/roles/test_template/files/foo.txt
+++ b/test/integration/roles/test_template/files/foo.txt
@@ -1,8 +1,8 @@
templated_var_loaded
{
- "bool": true,
- "multi_part": "1Foo",
- "number": 5,
+ "bool": true,
+ "multi_part": "1Foo",
+ "number": 5,
"string_num": "5"
}
diff --git a/test/integration/roles/test_template/tasks/main.yml b/test/integration/roles/test_template/tasks/main.yml
index 2568843cf7..0574868c9c 100644
--- a/test/integration/roles/test_template/tasks/main.yml
+++ b/test/integration/roles/test_template/tasks/main.yml
@@ -41,8 +41,18 @@
# VERIFY CONTENTS
+- name: check what python version ansible is running on
+ command: python -c 'import distutils.sysconfig ; print(distutils.sysconfig.get_python_version())'
+ register: pyver
+ delegate_to: localhost
+
- name: copy known good into place
copy: src=foo.txt dest={{output_dir}}/foo.txt
+ when: pyver.stdout != '2.6'
+
+- name: copy known good into place
+ copy: src=foo-py2.6.txt dest={{output_dir}}/foo.txt
+ when: pyver.stdout == '2.6'
- name: compare templated file to known good
shell: diff {{output_dir}}/foo.templated {{output_dir}}/foo.txt