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 4 months ago
parent 863f923f14
commit 85b1b4070a

@ -25,8 +25,7 @@
# special_python: source /tmp/fake && python
- name: set python using sourced file
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 && python{{ ansible_facts.python.version.major }}"
special_python: "source /tmp/fake || true && {{ ansible_facts.python.executable }}"
- name: run get_url with specially-sourced python
uri:

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

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

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

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

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

@ -12,7 +12,9 @@
https_proxy: "{{ lookup('env', 'https_proxy')|default('') }}"
no_proxy: "{{ lookup('env', 'no_proxy')|default('') }}"
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:
- lout.python.version.full is version('2.7', '>=', strict=True)

Loading…
Cancel
Save