Update role for new source build process

The variables barbican_developer_mode and barbican_venv_download
no longer carry any meaning. This review changes glance 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: Iab0b3b551aedfbe45016d9e3b0f860a8f783cdce
This commit is contained in:
Mohammed Naser 2019-03-26 17:29:35 -04:00
parent 08803533b9
commit fc3fac1e5c
3 changed files with 22 additions and 68 deletions

View File

@ -30,20 +30,12 @@ congress_package_state: "latest"
## Git repositories and their branches
congress_git_repo: https://git.openstack.org/openstack/congress
congress_git_install_branch: master
congress_developer_mode: false
congress_developer_constraints:
congress_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')) }}"
congress_git_constraints:
- "git+{{ congress_git_repo }}@{{ congress_git_install_branch }}#egg=congress"
- "--constraint {{ congress_upper_constraints_url }}"
# 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.
congress_pip_install_args: >-
{{ congress_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('') }}
congress_pip_install_args: "{{ pip_install_options | default('') }}"
## Virtual environment to deploy into
congress_venv_tag: "{{ venv_tag | default('untagged') }}"
@ -52,11 +44,6 @@ congress_bin: "/openstack/venvs/congress-{{ congress_venv_tag }}/bin"
## configuration directory
congress_etc_dir: "/etc/congress"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
congress_venv_download: "{{ not congress_developer_mode | bool }}"
congress_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/congress.tgz
## Common PIP packages
congress_pip_packages:
- congress
@ -65,6 +52,7 @@ congress_pip_packages:
- python-congressclient
- python-heatclient
- systemd-python
congress_user_pip_packages: []
congress_services:
congress-server:

View File

@ -1,50 +0,0 @@
---
# Copyright 2017, taseer94@gmail.com
# All rights reserved.
#
# 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 congress_developer_constraints %}
{{ item }}
{% endfor %}
when: congress_developer_mode | bool
- name: Ensure remote wheel building is disabled in developer mode
set_fact:
venv_build_host: "{{ ansible_hostname }}"
when:
- congress_developer_mode | bool
- name: Install the python venv
include_role:
name: "python_venv_build"
vars:
venv_build_distro_package_list: "{{ congress_devel_distro_packages }}"
venv_install_destination_path: "{{ congress_bin | dirname }}"
venv_install_distro_package_list: "{{ congress_distro_packages }}"
venv_pip_install_args: "{{ congress_pip_install_args }}"
venv_pip_packages: "{{ (congress_oslomsg_amqp1_enabled | bool) | ternary(congress_pip_packages + congress_optional_oslomsg_amqp1_pip_packages, congress_pip_packages) }}"
venv_facts_when_changed:
- section: "congress"
option: "venv_tag"
value: "{{ congress_venv_tag }}"

View File

@ -30,7 +30,23 @@
tags:
- congress-install
- include_tasks: congress_install.yml
- name: Install the python venv
import_role:
name: "python_venv_build"
vars:
venv_build_constraints: "{{ congress_git_constraints }}"
venv_build_distro_package_list: "{{ congress_devel_distro_packages }}"
venv_install_destination_path: "{{ congress_bin | dirname }}"
venv_install_distro_package_list: "{{ congress_distro_packages }}"
venv_pip_install_args: "{{ congress_pip_install_args }}"
venv_pip_packages: >-
{{ congress_pip_packages |
union(congress_user_pip_packages) |
union(((congress_oslomsg_amqp1_enabled | bool) | ternary(congress_optional_oslomsg_amqp1_pip_packages, []))) }}
venv_facts_when_changed:
- section: "congress"
option: "venv_tag"
value: "{{ congress_venv_tag }}"
tags:
- congress-install