From 2e839df328b86edf7d0a1b8800a34f8612281543 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Tue, 8 Aug 2017 00:19:23 +0100 Subject: [PATCH] ci-workers: Fail if Python is not version 2.7 Ansible works with Python 2.6 and 2.7, but Buildbot requires 2.7. Both have at least preliminary Python 3 support, but until our RPC tests are migrated to Python 3, we need to use Python 2 for testing, and so this requirement stands. --- contrib/ci-workers/unix.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/contrib/ci-workers/unix.yml b/contrib/ci-workers/unix.yml index 763d8fe45..ac53ae412 100644 --- a/contrib/ci-workers/unix.yml +++ b/contrib/ci-workers/unix.yml @@ -19,7 +19,7 @@ prompt: "Buildbot worker password (provided by ZECC)" pre_tasks: - - name: Install Python 2 for Ansible and Buildbot + - name: Install Python 2.7 for Ansible and Buildbot raw: test -e /usr/bin/python || test -e /usr/bin/python2 || test -e /usr/bin/python2.7 || test -e /usr/local/bin/python2.7 || (test -e /usr/bin/apt && apt -qqy update && apt install -qqy python) || (test -e /usr/bin/dnf && dnf install -qqy python2) || (test -e /usr/sbin/pkg && pkg install -qqy python2) register: output changed_when: @@ -34,7 +34,7 @@ - name: Fail if configured Python is unavailable fail: - msg: Python is not accessible at {{ ansible_python_interpreter }} on this host! Please set the inventory variable 'ansible_python_interpreter' to the location of the Python 2 binary. + msg: "Python is not accessible at {{ ansible_python_interpreter }} on this host! Please set the inventory variable 'ansible_python_interpreter' to the location of the Python 2.7 binary." when: ansible_python_interpreter is defined and python_check.rc == 1 - name: Check if Python is in the default location @@ -45,12 +45,17 @@ - name: Fail if default Python is unavailable fail: - msg: Python is not accessible at /usr/bin/python on this host! Please set the inventory variable 'ansible_python_interpreter' to the location of the Python 2 binary. + msg: Python is not accessible at /usr/bin/python on this host! Please set the inventory variable 'ansible_python_interpreter' to the location of the Python 2.7 binary. when: ansible_python_interpreter is undefined and python_check.rc == 1 - name: Gathering Facts setup: + - name: Fail if Python is the wrong version + fail: + msg: "The Python binary at {{ ansible_python.executable }} is version {{ ansible_python_version }}! Please set the inventory variable 'ansible_python_interpreter' to the location of the Python 2.7 binary." + when: ansible_python.version.major != 2 or ansible_python.version.minor != 7 + tasks: - name: Get dependencies for distribution include_vars: "{{ item }}"