mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Make template test work with both py2.6 and 2.7+
This commit is contained in:
parent
aafda44bb3
commit
8d0ceeca91
3 changed files with 21 additions and 3 deletions
8
test/integration/roles/test_template/files/foo-py26.txt
Normal file
8
test/integration/roles/test_template/files/foo-py26.txt
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
templated_var_loaded
|
||||||
|
|
||||||
|
{
|
||||||
|
"bool": true,
|
||||||
|
"multi_part": "1Foo",
|
||||||
|
"number": 5,
|
||||||
|
"string_num": "5"
|
||||||
|
}
|
|
@ -41,8 +41,18 @@
|
||||||
|
|
||||||
# VERIFY CONTENTS
|
# 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
|
- name: copy known good into place
|
||||||
copy: src=foo.txt dest={{output_dir}}/foo.txt
|
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
|
- name: compare templated file to known good
|
||||||
shell: diff {{output_dir}}/foo.templated {{output_dir}}/foo.txt
|
shell: diff {{output_dir}}/foo.templated {{output_dir}}/foo.txt
|
||||||
|
|
Loading…
Reference in a new issue