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: Ifd7d4d0a314834165141019dbacb82bbc1c4176d
This commit is contained in:
Mohammed Naser 2019-03-26 17:32:48 -04:00
parent 8aac371b10
commit ddc9c0fdf9
3 changed files with 20 additions and 74 deletions

View File

@ -36,26 +36,12 @@ designate_install_method: "source"
## The git source/branch
designate_git_repo: https://git.openstack.org/openstack/designate
designate_git_install_branch: master
# Developer mode is used for role functional testing and allows the role
# to build an environment directly from a git source without the presence
# of an OpenStack-Ansible repo_server.
designate_developer_mode: False
## The packages to build from source (used in developer mode)
designate_developer_constraints:
designate_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')) }}"
designate_git_constraints:
- "git+{{ designate_git_repo }}@{{ designate_git_install_branch }}#egg=designate"
- "--constraint {{ barbican_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.
designate_pip_install_args: >-
{{ designate_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('') }}
designate_pip_install_args: "{{ pip_install_options | default('') }}"
# Name of the virtual env to deploy into
designate_venv_tag: "{{ venv_tag | default('untagged') }}"
@ -67,12 +53,6 @@ designate_bin: "{{ _designate_bin }}"
# designate_etc_dir: "/usr/local/etc/designate"
designate_etc_dir: "{{ _designate_etc }}/designate"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
designate_venv_download: "{{ not designate_developer_mode | bool }}"
# URL of the pre-built virtualenv
designate_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/designate.tgz
## System info
designate_system_user_name: designate
designate_system_group_name: designate
@ -200,6 +180,7 @@ designate_pip_packages:
- python-memcached
- systemd-python
- warlock
designate_user_pip_packages: []
designate_optional_oslomsg_amqp1_pip_packages:
- oslo.messaging[amqp1]

View File

@ -36,6 +36,19 @@
retries: 5
delay: 2
- name: Install designate packages from PIP
include_tasks: designate_install_source.yml
- name: Install the python venv
include_role:
name: "python_venv_build"
vars:
venv_build_distro_package_list: "{{ designate_devel_distro_packages }}"
venv_install_destination_path: "{{ designate_bin | dirname }}"
venv_pip_install_args: "{{ designate_pip_install_args }}"
venv_pip_packages: >-
{{ designate_pip_packages |
union(designate_user_pip_packages) |
union(((designate_oslomsg_amqp1_enabled | bool) | ternary(designate_optional_oslomsg_amqp1_pip_packages, []))) }}
venv_facts_when_changed:
- section: "designate"
option: "venv_tag"
value: "{{ designate_venv_tag }}"
when: designate_install_method == 'source'

View File

@ -1,48 +0,0 @@
---
# Copyright 2018, SUSE LINUX GmbH.
#
# 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 designate_developer_constraints %}
{{ item }}
{% endfor %}
when: designate_developer_mode | bool
- name: Ensure remote wheel building is disabled in developer mode
set_fact:
venv_build_host: "{{ inventory_hostname }}"
when:
- designate_developer_mode | bool
- name: Install the python venv
include_role:
name: "python_venv_build"
vars:
venv_build_distro_package_list: "{{ designate_devel_distro_packages }}"
venv_install_destination_path: "{{ designate_bin | dirname }}"
venv_pip_install_args: "{{ designate_pip_install_args }}"
venv_pip_packages: "{{ (designate_oslomsg_amqp1_enabled | bool) | ternary(designate_pip_packages + designate_optional_oslomsg_amqp1_pip_packages, designate_pip_packages) }}"
venv_facts_when_changed:
- section: "designate"
option: "venv_tag"
value: "{{ designate_venv_tag }}"