Browse Source

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] 3f8a22a51b
Change-Id: Ibb5a068350b30f0d74ef26a55528527bd9e646a3
changes/85/596885/2
Jesse Pretorius 9 months ago
parent
commit
ca0211a08b
1 changed files with 40 additions and 16 deletions
  1. 40
    16
      tasks/gnocchi_install.yml

+ 40
- 16
tasks/gnocchi_install.yml View File

@@ -72,23 +72,47 @@
72 72
     - Restart gnocchi services
73 73
     - Restart web server
74 74
 
75
-- name: Install pip packages
76
-  pip:
77
-    name: "{{ gnocchi_pip_packages }}"
78
-    state: "{{ gnocchi_pip_package_state }}"
79
-    virtualenv: "{{ gnocchi_bin | dirname }}"
80
-    virtualenv_site_packages: "no"
81
-    extra_args: >-
82
-      {{ gnocchi_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
83
-      {{ pip_install_options | default('') }}
84
-  register: install_packages
85
-  until: install_packages is success
86
-  retries: 5
87
-  delay: 2
75
+- name: Create the python venv and install packages into it
88 76
   when: gnocchi_get_venv | failed or gnocchi_get_venv | skipped
89
-  notify:
90
-    - Restart gnocchi services
91
-    - Restart web server
77
+  block:
78
+    - name: Create the virtualenv (if it does not exist)
79
+      command: "virtualenv --never-download --no-site-packages {{ gnocchi_bin | dirname }}"
80
+      args:
81
+        creates: "{{ gnocchi_bin }}/activate"
82
+
83
+    - name: Upgrade pip/setuptools/wheel to the versions we want
84
+      pip:
85
+        name:
86
+          - pip
87
+          - setuptools
88
+          - wheel
89
+        state: "{{ gnocchi_pip_package_state }}"
90
+        virtualenv: "{{ gnocchi_bin | dirname }}"
91
+        virtualenv_site_packages: "no"
92
+        extra_args: >-
93
+          {{ gnocchi_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
94
+          {{ pip_install_options | default('') }}
95
+      register: install_packages
96
+      until: install_packages is success
97
+      retries: 5
98
+      delay: 2
99
+
100
+    - name: Install pip packages
101
+      pip:
102
+        name: "{{ gnocchi_pip_packages }}"
103
+        state: "{{ gnocchi_pip_package_state }}"
104
+        virtualenv: "{{ gnocchi_bin | dirname }}"
105
+        virtualenv_site_packages: "no"
106
+        extra_args: >-
107
+          {{ gnocchi_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
108
+          {{ pip_install_options | default('') }}
109
+      register: install_packages
110
+      until: install_packages is success
111
+      retries: 5
112
+      delay: 2
113
+      notify:
114
+        - Restart gnocchi services
115
+        - Restart web server
92 116
 
93 117
 - name: Remove python from path first (CentOS, openSUSE)
94 118
   file:

Loading…
Cancel
Save