Do not hardcode python executable in test (#17380)

Based on https://github.com/ansible/ansible/pull/17376
pull/17381/head
Michael Scherer 8 years ago committed by Matt Clay
parent 4ae59b2743
commit 918d1e038e

@ -17,7 +17,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- name: generate random string
command: python -c "import string,random; print ''.join(random.choice(string.ascii_lowercase) for _ in range(8));"
command: '{{ ansible_python.executable }} -c "import string,random; print ''.join(random.choice(string.ascii_lowercase) for _ in range(8));"'
register: random_string
tags:
- prepare

@ -17,7 +17,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- name: Determine if python looks like it will support modern ssl features like SNI
command: python -c 'from ssl import SSLContext'
command: "{{ ansible_python.executable }} -c 'from ssl import SSLContext'"
ignore_errors: True
register: python_test

@ -37,7 +37,7 @@
that:
- "not uninstall_result.changed"
- shell: "python -c 'import {{ pip_test_package }}'"
- shell: "{{ ansible_python.executable }} -c 'import {{ pip_test_package }}'"
register: absent_result
ignore_errors: True
@ -58,7 +58,7 @@
that:
- "install_result.changed == True"
- shell: "python -c 'import {{ pip_test_package }}'"
- shell: "{{ ansible_python.executable }} -c 'import {{ pip_test_package }}'"
register: installed_result
# now remove it to test uninstallation of a package we are sure is installed

@ -42,7 +42,7 @@
# VERIFY CONTENTS
- name: check what python version ansible is running on
command: python -c 'import distutils.sysconfig ; print(distutils.sysconfig.get_python_version())'
command: "{{ ansible_python.executable }} -c 'import distutils.sysconfig ; print(distutils.sysconfig.get_python_version())'"
register: pyver
delegate_to: localhost

@ -1,4 +1,4 @@
- shell: python -c "import tempfile; print(tempfile.mkstemp()[1])"
- shell: '{{ ansible_python.executable }} -c "import tempfile; print(tempfile.mkstemp()[1])"'
register: tempfilepath
- set_fact:

Loading…
Cancel
Save