From ca0211a08ba362145ad4ed7be5404863dc02843c Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Mon, 27 Aug 2018 20:55:42 +0100 Subject: [PATCH] Upgrade pip/setuptools/wheel in role test venv In the integrated build, the repo build process upgrades pip/setuptools/wheel in the venv to our preferred pinned version, but the role tests using developer mode does not. Gnocchi, since 4.3.0 [1] requires setuptools > 30.3.0 - but CentOS only has 28.8.0 when it builds the venv, so the package install fails. In this patch we create the venv, then upgrade pip, setuptools and wheel, then install the keystone packages. Doing this for all roles is impractical, but it will be necessary to unblock patches from merging into this role today. In the future when we use the python_venv_build role we can do all this there instead of repeating this patch across all the roles. [1] https://github.com/gnocchixyz/gnocchi/commit/3f8a22a51bec3a60709bcbf26648c4fd6a66d2b8 Change-Id: Ibb5a068350b30f0d74ef26a55528527bd9e646a3 --- tasks/gnocchi_install.yml | 56 ++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/tasks/gnocchi_install.yml b/tasks/gnocchi_install.yml index d2050ac..2ab4d7d 100644 --- a/tasks/gnocchi_install.yml +++ b/tasks/gnocchi_install.yml @@ -72,23 +72,47 @@ - Restart gnocchi services - Restart web server -- name: Install pip packages - pip: - name: "{{ gnocchi_pip_packages }}" - state: "{{ gnocchi_pip_package_state }}" - virtualenv: "{{ gnocchi_bin | dirname }}" - virtualenv_site_packages: "no" - extra_args: >- - {{ gnocchi_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }} - {{ pip_install_options | default('') }} - register: install_packages - until: install_packages is success - retries: 5 - delay: 2 +- name: Create the python venv and install packages into it when: gnocchi_get_venv | failed or gnocchi_get_venv | skipped - notify: - - Restart gnocchi services - - Restart web server + block: + - name: Create the virtualenv (if it does not exist) + command: "virtualenv --never-download --no-site-packages {{ gnocchi_bin | dirname }}" + args: + creates: "{{ gnocchi_bin }}/activate" + + - name: Upgrade pip/setuptools/wheel to the versions we want + pip: + name: + - pip + - setuptools + - wheel + state: "{{ gnocchi_pip_package_state }}" + virtualenv: "{{ gnocchi_bin | dirname }}" + virtualenv_site_packages: "no" + extra_args: >- + {{ gnocchi_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }} + {{ pip_install_options | default('') }} + register: install_packages + until: install_packages is success + retries: 5 + delay: 2 + + - name: Install pip packages + pip: + name: "{{ gnocchi_pip_packages }}" + state: "{{ gnocchi_pip_package_state }}" + virtualenv: "{{ gnocchi_bin | dirname }}" + virtualenv_site_packages: "no" + extra_args: >- + {{ gnocchi_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }} + {{ pip_install_options | default('') }} + register: install_packages + until: install_packages is success + retries: 5 + delay: 2 + notify: + - Restart gnocchi services + - Restart web server - name: Remove python from path first (CentOS, openSUSE) file: