Update role for new source build process

The variables trove_developer_mode and trove_venv_download
no longer carry any meaning. This review changes trove 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: I08c864eaef894074326d765bb424fa6b98ec0ed2
This commit is contained in:
Guilherme Steinmüller 2019-03-27 18:20:57 +00:00
parent f733a26165
commit c9330452d0
3 changed files with 21 additions and 71 deletions

View File

@ -78,32 +78,18 @@ trove_conductor_workers: "{{ [[ansible_processor_vcpus|default(2) // 2, 1] | max
# Enable/Disable Ceilometer # Enable/Disable Ceilometer
trove_ceilometer_enabled: False trove_ceilometer_enabled: False
# TODO(odyssey4me): trove_pip_install_args: "{{ pip_install_options | default('') }}"
# 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.
trove_pip_install_args: >-
{{ trove_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
trove_venv_tag: "{{ venv_tag | default('untagged') }}" trove_venv_tag: "{{ venv_tag | default('untagged') }}"
trove_bin: "/openstack/venvs/trove-{{ trove_venv_tag }}/bin" trove_bin: "/openstack/venvs/trove-{{ trove_venv_tag }}/bin"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
trove_venv_download: "{{ not trove_developer_mode | bool }}"
trove_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/trove.tgz
trove_git_repo: "https://git.openstack.org/openstack/trove" trove_git_repo: "https://git.openstack.org/openstack/trove"
trove_git_install_branch: master trove_git_install_branch: master
trove_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')) }}"
trove_developer_mode: false trove_git_constraints:
trove_developer_constraints:
- "git+{{ trove_git_repo }}@{{ trove_git_install_branch }}#egg=trove" - "git+{{ trove_git_repo }}@{{ trove_git_install_branch }}#egg=trove"
- "--constraint {{ trove_upper_constraints_url }}"
#: Set this to false to disable API service through Apache + mod_wsgi #: Set this to false to disable API service through Apache + mod_wsgi
trove_use_mod_wsgi: false trove_use_mod_wsgi: false
@ -165,6 +151,9 @@ trove_oslomsg_notify_vhost: "{{ trove_oslomsg_rpc_vhost }}"
# TODO(ansmith): Change structure when more backends will be supported # TODO(ansmith): Change structure when more backends will be supported
trove_oslomsg_amqp1_enabled: "{{ trove_oslomsg_rpc_transport == 'amqp' }}" trove_oslomsg_amqp1_enabled: "{{ trove_oslomsg_rpc_transport == 'amqp' }}"
# Specific pip packages provided by the user
trove_user_pip_packages: []
# Rabbit vars # Rabbit vars
trove_control_exchange: trove trove_control_exchange: trove
trove_rabbit_notification_topic: notification trove_rabbit_notification_topic: notification

View File

@ -39,7 +39,20 @@
tags: tags:
- trove-install - trove-install
- include_tasks: trove_install.yml - name: Install the python venv
import_role:
name: "python_venv_build"
vars:
venv_build_constraints: "{{ trove_git_constraints }}"
venv_install_destination_path: "{{ trove_bin | dirname }}"
venv_install_distro_package_list: "{{ trove_distro_packages }}"
venv_pip_install_args: "{{ trove_pip_install_args }}"
venv_pip_packages: "{{ trove_pip_packages | union(trove_user_pip_packages) +
(trove_oslomsg_amqp1_enabled | bool) | ternary(trove_optional_oslomsg_amqp1_pip_packages, []) }}"
venv_facts_when_changed:
- section: "trove"
option: "venv_tag"
value: "{{ trove_venv_tag }}"
tags: tags:
- trove-install - trove-install

View File

@ -1,52 +0,0 @@
---
# Copyright 2016 Internet Solutions (Pty) Ltd
#
# 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.
#
# (c) 2016 Donovan Francesco <donovan.francesco@is.co.za>
# (c) 2016 Paul Stevens <paul.stevens@is.co.za>
# 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 trove_developer_constraints %}
{{ item }}
{% endfor %}
when:
- trove_developer_mode | bool
- name: Ensure remote wheel building is disabled in developer mode
set_fact:
venv_build_host: "{{ ansible_hostname }}"
when:
- trove_developer_mode | bool
- name: Install the python venv
include_role:
name: "python_venv_build"
vars:
venv_install_destination_path: "{{ trove_bin | dirname }}"
venv_install_distro_package_list: "{{ trove_distro_packages }}"
venv_pip_install_args: "{{ trove_pip_install_args }}"
venv_pip_packages: "{{ (trove_oslomsg_amqp1_enabled | bool) | ternary(trove_pip_packages + trove_optional_oslomsg_amqp1_pip_packages, trove_pip_packages) }}"
venv_facts_when_changed:
- section: "trove"
option: "venv_tag"
value: "{{ trove_venv_tag }}"