From 0a244ca090dab501cd2825ce5d54702761c01515 Mon Sep 17 00:00:00 2001 From: Marc Gariepy Date: Tue, 9 Jun 2020 15:09:12 -0400 Subject: [PATCH] auto-detect interpreter setting ANSIBLE_PYTHON_INTERPRETER to auto will use the value from the ansible/config/base.yml debian gets a /usr/bin/python3 for now and need to revisit once we have ansible 2.10. Change-Id: I503c1b71c0d01eea668500c0125c752c0584a7ef Co-Authored-By: Jonathan Rosser --- get-ansible-role-requirements.yml | 1 - test-ansible-functional.sh | 10 ++++++++++ test-install-horizon.yml | 2 -- tests/host_vars/localhost.yml | 1 - 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/get-ansible-role-requirements.yml b/get-ansible-role-requirements.yml index 0509ad50..edb6014b 100644 --- a/get-ansible-role-requirements.yml +++ b/get-ansible-role-requirements.yml @@ -136,7 +136,6 @@ - item['scm'] == "git" or item['scm'] is undefined vars: - ansible_python_interpreter: "/usr/bin/python3" homedir: "{{ lookup('env', 'TESTING_HOME') }}" role_file: "{{ lookup('env', 'ANSIBLE_ROLE_REQUIREMENTS_PATH') }}" osa_roles: "{{ lookup('file', role_file) | from_yaml }}" diff --git a/test-ansible-functional.sh b/test-ansible-functional.sh index 60e52b3d..5e3dcc7a 100755 --- a/test-ansible-functional.sh +++ b/test-ansible-functional.sh @@ -29,6 +29,15 @@ set -e ## Vars ---------------------------------------------------------------------- +# Source distribution information +source /etc/os-release || source /usr/lib/os-release + +#TODO: cleanup on ansible 2.10 if debian is in config/base.yml +if [ "${ID}" == "debian" ] && [ "${VERSION_ID}" == "10" ]; then + ANSIBLE_PYTHON_INTERPRETER="/usr/bin/python3" +fi + +export ANSIBLE_PYTHON_INTERPRETER=${ANSIBLE_PYTHON_INTERPRETER:-auto} export TESTING_HOME=${TESTING_HOME:-$HOME} export WORKING_DIR=${WORKING_DIR:-$(pwd)} @@ -48,6 +57,7 @@ echo "ANSIBLE_PARAMETERS: ${ANSIBLE_PARAMETERS}" echo "TEST_PLAYBOOK: ${TEST_PLAYBOOK}" echo "TEST_CHECK_MODE: ${TEST_CHECK_MODE}" echo "TEST_IDEMPOTENCE: ${TEST_IDEMPOTENCE}" +echo "ANSIBLE_PYTHON_INTERPRETER: ${ANSIBLE_PYTHON_INTERPRETER}" ## Functions ----------------------------------------------------------------- diff --git a/test-install-horizon.yml b/test-install-horizon.yml index 32ab8d34..98807ba6 100644 --- a/test-install-horizon.yml +++ b/test-install-horizon.yml @@ -29,8 +29,6 @@ become: no gather_facts: false any_errors_fatal: true - vars: - ansible_python_interpreter: "{{ ansible_playbook_python }}" vars_files: - test-vars.yml tasks: diff --git a/tests/host_vars/localhost.yml b/tests/host_vars/localhost.yml index c44d403e..253043ce 100644 --- a/tests/host_vars/localhost.yml +++ b/tests/host_vars/localhost.yml @@ -21,4 +21,3 @@ bridges: ip_addr: "10.1.2.1" veth_peer: "veth-test" -ansible_python_interpreter: "/usr/bin/python"