ensure-tox: use ensure-pip role

Use the ensure-pip role to ensure that `pip` is available.  If the
existing flag `tox_prefer_python2` is set, we pass along the flag to
ensure-pip to install Python 2 pip as well.

Story: #2007386
Task: #39308
Change-Id: I5053e315df8d2ea9892911800c88afcbe31cc05b
This commit is contained in:
Ian Wienand 2020-04-06 15:39:26 +10:00 committed by Clark Boylan
parent 3fc3083456
commit 8f06e1a536
3 changed files with 12 additions and 0 deletions

View File

@ -20,3 +20,8 @@ a valid ``tox``.
If tox is not detected, prefer to install tox inside Python 2
instead of Python 3.
If set,
:zuul:rolevar:`ensure-pip.ensure_pip_from_packages_with_python2`
will be automatically set to `True` to enable a Python 2
installation of `pip`.

View File

@ -1,3 +1,9 @@
- name: Install pip
include_role:
name: ensure-pip
vars:
ensure_pip_from_packages_with_python2: '{{ tox_prefer_python2 }}'
- name: Ensure tox is installed
shell: |
set -euo pipefail

View File

@ -40,6 +40,7 @@
pip:
name: tox
virtualenv: "{{ ansible_user_dir }}/tox-venv"
virtualenv_command: "{{ ensure_pip_virtualenv_command }}"
- name: Run ensure-tox pointing to an already installed tox
include_role:
name: ensure-tox