mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Do not hardcode python executable in test (#17380)
Based on https://github.com/ansible/ansible/pull/17376
This commit is contained in:
parent
4ae59b2743
commit
918d1e038e
5 changed files with 6 additions and 6 deletions
|
@ -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…
Reference in a new issue