Browse Source

Update role for new source build process

The variables placement_developer_mode and placement_venv_download
no longer carry any meaning. This review changes placement to
do the equivalent of what developer_mode was all the time,
meaning that it always builds the venv and never requires
the repo server, but it will use a repo server when available.

As part of this, we move the source build out of its own file
because it's now a single task to include the venv build role.
This is just to make it easier to follow the code.

Change-Id: Ieac9e2fba7e222d31c29eebf699968455a727758
Mohammed Naser 3 weeks ago
parent
commit
2ee8cdc3d3
3 changed files with 20 additions and 67 deletions
  1. 4
    13
      defaults/main.yml
  2. 16
    2
      tasks/placement_install.yml
  3. 0
    52
      tasks/placement_install_source.yml

+ 4
- 13
defaults/main.yml View File

@@ -28,21 +28,12 @@ placement_service_setup_host_python_interpreter: "{{ openstack_service_setup_hos
28 28
 
29 29
 placement_git_repo: https://git.openstack.org/openstack/placement
30 30
 placement_git_install_branch: master
31
-placement_developer_mode: false
32
-placement_developer_constraints:
31
+placement_upper_constraints_url: "{{ requirements_git_url | default('https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=' ~ requirements_git_install_branch | default('master')) }}"
32
+placement_git_constraints:
33 33
   - "git+{{ placement_git_repo }}@{{ placement_git_install_branch }}#egg=openstack-placement"
34
+  - "--constraint {{ placement_upper_constraints_url }}"
34 35
 
35
-
36
-# TODO(odyssey4me):
37
-# This can be simplified once all the roles are using
38
-# python_venv_build. We can then switch to using a
39
-# set of constraints in pip.conf inside the venv,
40
-# perhaps prepared by giving a giving a list of
41
-# constraints to the role.
42
-placement_pip_install_args: >-
43
-  {{ placement_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
44
-  {{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''), '') }}
45
-  {{ pip_install_options | default('') }}
36
+placement_pip_install_args: "{{ pip_install_options | default('') }}"
46 37
 
47 38
 # Name of the virtual env to deploy into
48 39
 placement_venv_tag: "{{ venv_tag | default('untagged') }}"

+ 16
- 2
tasks/placement_install.yml View File

@@ -36,8 +36,22 @@
36 36
   retries: 5
37 37
   delay: 2
38 38
 
39
-- name: Install placement packages from PIP
40
-  include_tasks: placement_install_source.yml
39
+- name: Install the python venv
40
+  import_role:
41
+    name: "python_venv_build"
42
+  vars:
43
+    venv_build_constraints: "{{ placement_git_constraints }}"
44
+    venv_install_destination_path: "{{ placement_bin | dirname }}"
45
+    venv_install_distro_package_list: "{{ placement_distro_packages }}"
46
+    venv_pip_install_args: "{{ placement_pip_install_args }}"
47
+    venv_pip_packages: "{{ placement_pip_packages }}"
48
+    venv_facts_when_changed:
49
+      - section: "placement"
50
+        option: "need_service_restart"
51
+        value: True
52
+      - section: "placement"
53
+        option: "venv_tag"
54
+        value: "{{ placement_venv_tag }}"
41 55
   when: placement_install_method == 'source'
42 56
 
43 57
 - name: Record the need for a service restart

+ 0
- 52
tasks/placement_install_source.yml View File

@@ -1,52 +0,0 @@
1
----
2
-# Copyright 2019, VEXXHOST, Inc.
3
-#
4
-# Licensed under the Apache License, Version 2.0 (the "License");
5
-# you may not use this file except in compliance with the License.
6
-# You may obtain a copy of the License at
7
-#
8
-#     http://www.apache.org/licenses/LICENSE-2.0
9
-#
10
-# Unless required by applicable law or agreed to in writing, software
11
-# distributed under the License is distributed on an "AS IS" BASIS,
12
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-# See the License for the specific language governing permissions and
14
-# limitations under the License.
15
-
16
-# TODO(odyssey4me):
17
-# This can be simplified once all the roles are using
18
-# python_venv_build. We can then switch to using a
19
-# set of constraints in pip.conf inside the venv,
20
-# perhaps prepared by giving a giving a list of
21
-# constraints to the role.
22
-- name: Create developer mode constraint file
23
-  copy:
24
-    dest: "/opt/developer-pip-constraints.txt"
25
-    content: |
26
-      {% for item in placement_developer_constraints %}
27
-      {{ item }}
28
-      {% endfor %}
29
-  when: placement_developer_mode | bool
30
-
31
-- name: Ensure remote wheel building is disabled in developer mode
32
-  set_fact:
33
-    venv_build_host: "{{ ansible_hostname }}"
34
-  when:
35
-    - placement_developer_mode | bool
36
-
37
-- name: Install the python venv
38
-  include_role:
39
-    name: "python_venv_build"
40
-    private: yes
41
-  vars:
42
-    venv_install_destination_path: "{{ placement_bin | dirname }}"
43
-    venv_install_distro_package_list: "{{ placement_distro_packages }}"
44
-    venv_pip_install_args: "{{ placement_pip_install_args }}"
45
-    venv_pip_packages: "{{ placement_pip_packages }}"
46
-    venv_facts_when_changed:
47
-      - section: "placement"
48
-        option: "need_service_restart"
49
-        value: True
50
-      - section: "placement"
51
-        option: "venv_tag"
52
-        value: "{{ placement_venv_tag }}"

Loading…
Cancel
Save