Update role for new source build process

The variable mistral_developer_mode and mistral_venv_download
no longer carry any meaning. This review changes mistral 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: Ibb0a20eeec763f2051c8577da5a91ddc5b9a9e62
This commit is contained in:
Guilherme Steinmüller 2019-03-26 17:52:50 +00:00
parent ff5e2e462c
commit a3770b9d39
3 changed files with 24 additions and 66 deletions

View File

@ -33,11 +33,12 @@ mistral_package_state: latest
mistral_role_project_group: mistral_all
# Source package builds
mistral_developer_mode: false
mistral_git_repo: https://git.openstack.org/openstack/mistral
mistral_git_install_branch: master
mistral_developer_constraints:
mistral_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')) }}"
mistral_git_constraints:
- "git+{{ mistral_git_repo }}@{{ mistral_git_install_branch }}#egg=mistral"
- "--constraint {{ mistral_upper_constraints_url }}"
mistral_pip_packages:
- mistral
- PyMySQL
@ -47,16 +48,8 @@ mistral_optional_oslomsg_amqp1_pip_packages:
- oslo.messaging[amqp1]
mistral_venv_tag: "{{ venv_tag | default('untagged') }}"
mistral_bin: "{{ _mistral_bin }}"
# 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.
mistral_pip_install_args: >-
{{ mistral_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('') }}
mistral_pip_install_args: "{{ pip_install_options | default('') }}"
# Services
mistral_services:
@ -161,3 +154,6 @@ mistral_service_internaluri_proto: "{{ openstack_service_internaluri_proto | def
mistral_service_internalurl: "{{ mistral_service_internaluri_proto }}://{{ internal_lb_vip_address }}:{{ mistral_service_port }}/v2"
mistral_service_adminuri_proto: "{{ openstack_service_adminuri_proto | default(mistral_service_proto) }}"
mistral_service_adminurl: "{{ mistral_service_adminuri_proto }}://{{ internal_lb_vip_address }}:{{ mistral_service_port }}/v2"
# Specific pip packages provided by the user
mistral_user_pip_packages: []

View File

@ -70,8 +70,22 @@
retries: 5
delay: 2
- name: Install mistral packages from PIP
include_tasks: mistral_install_source.yml
- name: Install the python venv
import_role:
name: "python_venv_build"
vars:
venv_build_constraints: "{{ mistral_git_constraints }}"
venv_build_distro_package_list: "{{ mistral_devel_distro_packages }}"
venv_install_destination_path: "{{ mistral_bin | dirname }}"
venv_pip_install_args: "{{ mistral_pip_install_args }}"
venv_pip_packages: >-
{{ mistral_pip_packages |
union(mistral_user_pip_packages) |
union(((mistral_oslomsg_amqp1_enabled | bool) | ternary(mistral_optional_oslomsg_amqp1_pip_packages, []))) }}
venv_facts_when_changed:
- section: "mistral"
option: "venv_tag"
value: "{{ mistral_venv_tag }}"
when: mistral_install_method == 'source'
- name: Record the need for a service restart

View File

@ -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 mistral_developer_constraints %}
{{ item }}
{% endfor %}
when: mistral_developer_mode | bool
- name: Ensure remote wheel building is disabled in developer mode
set_fact:
venv_build_host: "{{ inventory_hostname }}"
when: mistral_developer_mode | bool
- name: Install the python venv
include_role:
name: "python_venv_build"
vars:
venv_build_distro_package_list: "{{ mistral_devel_distro_packages }}"
venv_install_destination_path: "{{ mistral_bin | dirname }}"
venv_pip_install_args: "{{ mistral_pip_install_args }}"
venv_pip_packages: >-
{{ mistral_pip_packages +
(mistral_oslomsg_amqp1_enabled | bool) | ternary(mistral_optional_oslomsg_amqp1_pip_packages, []) }}
venv_facts_when_changed:
- section: "mistral"
option: "need_service_restart"
value: True
- section: "mistral"
option: "venv_tag"
value: "{{ mistral_venv_tag }}"