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: I58d0dc682f0e061f003b022c46277a4849ba4b2b
This commit is contained in:
parent
b61f586eed
commit
ea70314063
|
@ -92,38 +92,20 @@ barbican_paste_overrides: {}
|
|||
barbican_api_audit_map_overrides: {}
|
||||
barbican_vassals_api_overrides: {}
|
||||
|
||||
## Toggle developer mode
|
||||
barbican_developer_mode: false
|
||||
|
||||
## The git source/branch
|
||||
barbican_git_repo: "https://git.openstack.org/openstack/barbican"
|
||||
barbican_git_install_branch: master
|
||||
|
||||
## The packages to build from source (used in developer mode)
|
||||
barbican_developer_constraints:
|
||||
barbican_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')) }}"
|
||||
barbican_git_constraints:
|
||||
- "git+{{ barbican_git_repo }}@{{ barbican_git_install_branch }}#egg=barbican"
|
||||
- "--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.
|
||||
barbican_pip_install_args: >-
|
||||
{{ barbican_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('') }}
|
||||
barbican_pip_install_args: "{{ pip_install_options | default('') }}"
|
||||
|
||||
# Name of the virtual env to deploy into
|
||||
barbican_venv_tag: "{{ venv_tag | default('untagged') }}"
|
||||
barbican_bin: "{{ _barbican_bin }}"
|
||||
|
||||
# venv_download, even when true, will use the fallback method of building the
|
||||
# venv from scratch if the venv download fails.
|
||||
barbican_venv_download: "{{ not barbican_developer_mode | bool }}"
|
||||
# URL of the pre-built virtualenv
|
||||
barbican_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/barbican.tgz
|
||||
|
||||
# Database vars
|
||||
barbican_db_setup_host: "{{ ('galera_all' in groups) | ternary(groups['galera_all'][0], 'localhost') }}"
|
||||
barbican_galera_address: "{{ galera_address | default('127.0.0.1') }}"
|
||||
|
@ -197,6 +179,7 @@ barbican_pip_packages:
|
|||
- python-memcached
|
||||
- systemd-python
|
||||
- uwsgi
|
||||
barbican_user_pip_packages: []
|
||||
|
||||
barbican_optional_oslomsg_amqp1_pip_packages:
|
||||
- oslo.messaging[amqp1]
|
||||
|
|
|
@ -36,6 +36,21 @@
|
|||
retries: 5
|
||||
delay: 2
|
||||
|
||||
- name: Install barbican packages from PIP
|
||||
include_tasks: barbican_install_source.yml
|
||||
when: barbican_install_method == 'source'
|
||||
- name: Install the python venv
|
||||
import_role:
|
||||
name: "python_venv_build"
|
||||
vars:
|
||||
venv_build_constraints: "{{ barbican_git_constraints }}"
|
||||
venv_build_distro_package_list: "{{ barbican_devel_distro_packages }}"
|
||||
venv_install_destination_path: "{{ barbican_bin | dirname }}"
|
||||
venv_install_distro_package_list: "{{ barbican_distro_packages }}"
|
||||
venv_pip_install_args: "{{ barbican_pip_install_args }}"
|
||||
venv_pip_packages: >-
|
||||
{{ barbican_pip_packages |
|
||||
union(barbican_user_pip_packages) |
|
||||
union(((barbican_oslomsg_amqp1_enabled | bool) | ternary(barbican_optional_oslomsg_amqp1_pip_packages, []))) }}
|
||||
venv_facts_when_changed:
|
||||
- section: "barbican"
|
||||
option: "venv_tag"
|
||||
value: "{{ barbican_venv_tag }}"
|
||||
when: barbican_install_method == 'source'
|
|
@ -1,49 +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 barbican_developer_constraints %}
|
||||
{{ item }}
|
||||
{% endfor %}
|
||||
when: barbican_developer_mode | bool
|
||||
|
||||
- name: Ensure remote wheel building is disabled in developer mode
|
||||
set_fact:
|
||||
venv_build_host: "{{ inventory_hostname }}"
|
||||
when:
|
||||
- barbican_developer_mode | bool
|
||||
|
||||
- name: Install the python venv
|
||||
include_role:
|
||||
name: "python_venv_build"
|
||||
vars:
|
||||
venv_build_distro_package_list: "{{ barbican_devel_distro_packages }}"
|
||||
venv_install_destination_path: "{{ barbican_bin | dirname }}"
|
||||
venv_install_distro_package_list: "{{ barbican_distro_packages }}"
|
||||
venv_pip_install_args: "{{ barbican_pip_install_args }}"
|
||||
venv_pip_packages: "{{ (barbican_oslomsg_amqp1_enabled | bool) | ternary(barbican_pip_packages + barbican_optional_oslomsg_amqp1_pip_packages, barbican_pip_packages) }}"
|
||||
venv_facts_when_changed:
|
||||
- section: "barbican"
|
||||
option: "venv_tag"
|
||||
value: "{{ barbican_venv_tag }}"
|
Loading…
Reference in New Issue