tests: Respect configured or detected Python more often

Relying on the virtualenv default or hardcoding "python" results in a Python
2.x virtualenv on some targets (e.g. debian10-test). This caused a failure
when testing with Ansible >= 10 (ansible-core >= 2.17), which have dropped
Python 2.x support.

refs #1074
pull/1095/head
Alex Willmer 3 months ago
parent 863f923f14
commit 85b1b4070a

@ -25,8 +25,7 @@
# special_python: source /tmp/fake && python # special_python: source /tmp/fake && python
- name: set python using sourced file - name: set python using sourced file
set_fact: set_fact:
# Avoid 2.x vs 3.x cross-compatiblity issues (that I can't remember the exact details of). special_python: "source /tmp/fake || true && {{ ansible_facts.python.executable }}"
special_python: "source /tmp/fake || true && python{{ ansible_facts.python.version.major }}"
- name: run get_url with specially-sourced python - name: run get_url with specially-sourced python
uri: uri:

@ -12,7 +12,6 @@
- custom_python_detect_environment: - custom_python_detect_environment:
vars: vars:
ansible_connection: kubectl ansible_connection: kubectl
ansible_python_interpreter: python # avoid Travis virtualenv breakage
mitogen_kubectl_path: stub-kubectl.py mitogen_kubectl_path: stub-kubectl.py
register: out register: out

@ -8,7 +8,6 @@
- custom_python_detect_environment: - custom_python_detect_environment:
vars: vars:
ansible_connection: lxc ansible_connection: lxc
ansible_python_interpreter: python # avoid Travis virtualenv breakage
mitogen_lxc_attach_path: stub-lxc-attach.py mitogen_lxc_attach_path: stub-lxc-attach.py
register: out register: out

@ -8,7 +8,6 @@
- custom_python_detect_environment: - custom_python_detect_environment:
vars: vars:
ansible_connection: lxd ansible_connection: lxd
ansible_python_interpreter: python # avoid Travis virtualenv breakage
mitogen_lxc_path: stub-lxc.py mitogen_lxc_path: stub-lxc.py
register: out register: out

@ -8,7 +8,6 @@
- custom_python_detect_environment: - custom_python_detect_environment:
vars: vars:
ansible_connection: mitogen_doas ansible_connection: mitogen_doas
ansible_python_interpreter: python # avoid Travis virtualenv breakage
ansible_doas_exe: stub-doas.py ansible_doas_exe: stub-doas.py
ansible_user: someuser ansible_user: someuser
register: out register: out

@ -8,7 +8,6 @@
- custom_python_detect_environment: - custom_python_detect_environment:
vars: vars:
ansible_connection: mitogen_sudo ansible_connection: mitogen_sudo
ansible_python_interpreter: python # avoid Travis virtualenv breakage
ansible_user: root ansible_user: root
ansible_become_exe: stub-sudo.py ansible_become_exe: stub-sudo.py
ansible_become_flags: -H --type=sometype --role=somerole ansible_become_flags: -H --type=sometype --role=somerole

@ -12,7 +12,9 @@
https_proxy: "{{ lookup('env', 'https_proxy')|default('') }}" https_proxy: "{{ lookup('env', 'https_proxy')|default('') }}"
no_proxy: "{{ lookup('env', 'no_proxy')|default('') }}" no_proxy: "{{ lookup('env', 'no_proxy')|default('') }}"
PATH: "{{ lookup('env', 'PATH') }}" PATH: "{{ lookup('env', 'PATH') }}"
shell: virtualenv /tmp/issue_152_virtualenv command:
cmd: virtualenv -p "{{ ansible_facts.python.executable }}" /tmp/issue_152_virtualenv
creates: /tmp/issue_152_virtualenv
when: when:
- lout.python.version.full is version('2.7', '>=', strict=True) - lout.python.version.full is version('2.7', '>=', strict=True)

Loading…
Cancel
Save