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
This commit is contained in:
parent
2ee70fdf15
commit
2ee8cdc3d3
|
@ -28,21 +28,12 @@ placement_service_setup_host_python_interpreter: "{{ openstack_service_setup_hos
|
||||||
|
|
||||||
placement_git_repo: https://git.openstack.org/openstack/placement
|
placement_git_repo: https://git.openstack.org/openstack/placement
|
||||||
placement_git_install_branch: master
|
placement_git_install_branch: master
|
||||||
placement_developer_mode: false
|
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')) }}"
|
||||||
placement_developer_constraints:
|
placement_git_constraints:
|
||||||
- "git+{{ placement_git_repo }}@{{ placement_git_install_branch }}#egg=openstack-placement"
|
- "git+{{ placement_git_repo }}@{{ placement_git_install_branch }}#egg=openstack-placement"
|
||||||
|
- "--constraint {{ placement_upper_constraints_url }}"
|
||||||
|
|
||||||
|
placement_pip_install_args: "{{ pip_install_options | default('') }}"
|
||||||
# TODO(odyssey4me):
|
|
||||||
# This can be simplified once all the roles are using
|
|
||||||
# python_venv_build. We can then switch to using a
|
|
||||||
# set of constraints in pip.conf inside the venv,
|
|
||||||
# perhaps prepared by giving a giving a list of
|
|
||||||
# constraints to the role.
|
|
||||||
placement_pip_install_args: >-
|
|
||||||
{{ placement_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }}
|
|
||||||
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''), '') }}
|
|
||||||
{{ pip_install_options | default('') }}
|
|
||||||
|
|
||||||
# Name of the virtual env to deploy into
|
# Name of the virtual env to deploy into
|
||||||
placement_venv_tag: "{{ venv_tag | default('untagged') }}"
|
placement_venv_tag: "{{ venv_tag | default('untagged') }}"
|
||||||
|
|
|
@ -36,8 +36,22 @@
|
||||||
retries: 5
|
retries: 5
|
||||||
delay: 2
|
delay: 2
|
||||||
|
|
||||||
- name: Install placement packages from PIP
|
- name: Install the python venv
|
||||||
include_tasks: placement_install_source.yml
|
import_role:
|
||||||
|
name: "python_venv_build"
|
||||||
|
vars:
|
||||||
|
venv_build_constraints: "{{ placement_git_constraints }}"
|
||||||
|
venv_install_destination_path: "{{ placement_bin | dirname }}"
|
||||||
|
venv_install_distro_package_list: "{{ placement_distro_packages }}"
|
||||||
|
venv_pip_install_args: "{{ placement_pip_install_args }}"
|
||||||
|
venv_pip_packages: "{{ placement_pip_packages }}"
|
||||||
|
venv_facts_when_changed:
|
||||||
|
- section: "placement"
|
||||||
|
option: "need_service_restart"
|
||||||
|
value: True
|
||||||
|
- section: "placement"
|
||||||
|
option: "venv_tag"
|
||||||
|
value: "{{ placement_venv_tag }}"
|
||||||
when: placement_install_method == 'source'
|
when: placement_install_method == 'source'
|
||||||
|
|
||||||
- name: Record the need for a service restart
|
- name: Record the need for a service restart
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
---
|
|
||||||
# Copyright 2019, VEXXHOST, Inc.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
# TODO(odyssey4me):
|
|
||||||
# This can be simplified once all the roles are using
|
|
||||||
# python_venv_build. We can then switch to using a
|
|
||||||
# set of constraints in pip.conf inside the venv,
|
|
||||||
# perhaps prepared by giving a giving a list of
|
|
||||||
# constraints to the role.
|
|
||||||
- name: Create developer mode constraint file
|
|
||||||
copy:
|
|
||||||
dest: "/opt/developer-pip-constraints.txt"
|
|
||||||
content: |
|
|
||||||
{% for item in placement_developer_constraints %}
|
|
||||||
{{ item }}
|
|
||||||
{% endfor %}
|
|
||||||
when: placement_developer_mode | bool
|
|
||||||
|
|
||||||
- name: Ensure remote wheel building is disabled in developer mode
|
|
||||||
set_fact:
|
|
||||||
venv_build_host: "{{ ansible_hostname }}"
|
|
||||||
when:
|
|
||||||
- placement_developer_mode | bool
|
|
||||||
|
|
||||||
- name: Install the python venv
|
|
||||||
include_role:
|
|
||||||
name: "python_venv_build"
|
|
||||||
private: yes
|
|
||||||
vars:
|
|
||||||
venv_install_destination_path: "{{ placement_bin | dirname }}"
|
|
||||||
venv_install_distro_package_list: "{{ placement_distro_packages }}"
|
|
||||||
venv_pip_install_args: "{{ placement_pip_install_args }}"
|
|
||||||
venv_pip_packages: "{{ placement_pip_packages }}"
|
|
||||||
venv_facts_when_changed:
|
|
||||||
- section: "placement"
|
|
||||||
option: "need_service_restart"
|
|
||||||
value: True
|
|
||||||
- section: "placement"
|
|
||||||
option: "venv_tag"
|
|
||||||
value: "{{ placement_venv_tag }}"
|
|
Loading…
Reference in New Issue