Update role for new source build process

The developer mode and venv download modes at the moment
no longer carry any meaning. This review changes this role 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: I53d1fb9ace5eb3e66ca8aef08603abf580acc066
This commit is contained in:
Mohammed Naser 2019-03-27 15:33:06 -04:00
parent fef91642f3
commit fea7841682
3 changed files with 29 additions and 81 deletions

View File

@ -33,35 +33,19 @@ keystone_install_method: "source"
# Role standard API override this option in the OS variable files
keystone_shibboleth_repo: {}
# These variables are used in 'developer mode' in order to allow the role
# to build an environment directly from a git source without the presence
# of an OpenStack-Ansible repo_server.
keystone_git_repo: https://git.openstack.org/openstack/keystone
keystone_git_install_branch: master
keystone_developer_mode: false
keystone_developer_constraints:
keystone_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')) }}"
keystone_git_constraints:
- "git+{{ keystone_git_repo }}@{{ keystone_git_install_branch }}#egg=keystone"
- "--constraint {{ keystone_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.
keystone_pip_install_args: >-
{{ keystone_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('') }}
keystone_pip_install_args: "{{ pip_install_options | default('') }}"
# Name of the virtual env to deploy into
keystone_venv_tag: "{{ venv_tag | default('untagged') }}"
keystone_bin: "{{ _keystone_bin }}"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
keystone_venv_download: "{{ not keystone_developer_mode | bool }}"
keystone_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/keystone.tgz
keystone_fatal_deprecations: False
## System info

View File

@ -112,8 +112,31 @@
- Manage LB
- Restart web server
- name: Install keystone packages from PIP
include_tasks: keystone_install_source.yml
- name: Install the python venv
import_role:
name: "python_venv_build"
vars:
venv_build_constraints: "{{ keystone_git_constraints }}"
venv_build_distro_package_list: "{{ keystone_devel_distro_packages }}"
venv_install_destination_path: "{{ keystone_bin | dirname }}"
venv_pip_install_args: "{{ keystone_pip_install_args }}"
venv_pip_packages: >-
{{ keystone_pip_packages |
union(keystone_user_pip_packages) |
union(((keystone_oslomsg_amqp1_enabled | bool) | ternary(keystone_optional_oslomsg_amqp1_pip_packages, []))) }}
venv_facts_when_changed:
- section: "keystone"
option: "need_db_expand"
value: "True"
- section: "keystone"
option: "need_db_migrate"
value: "True"
- section: "keystone"
option: "need_db_contract"
value: "True"
- section: "keystone"
option: "venv_tag"
value: "{{ keystone_venv_tag }}"
when: keystone_install_method == 'source'
# TODO(hwoarang): We need to have a venv_tag local fact deployed since we use it in the

View File

@ -1,59 +0,0 @@
---
# Copyright 2014, Rackspace US, 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 keystone_developer_constraints %}
{{ item }}
{% endfor %}
when: keystone_developer_mode | bool
- name: Ensure remote wheel building is disabled in developer mode
set_fact:
venv_build_host: "{{ inventory_hostname }}"
when:
- keystone_developer_mode | bool
- name: Install the python venv
include_role:
name: "python_venv_build"
vars:
venv_build_distro_package_list: "{{ keystone_devel_distro_packages }}"
venv_install_destination_path: "{{ keystone_bin | dirname }}"
venv_pip_install_args: "{{ keystone_pip_install_args }}"
venv_pip_packages: >-
{{ keystone_pip_packages | union(keystone_user_pip_packages) +
(keystone_oslomsg_amqp1_enabled | bool) | ternary(keystone_optional_oslomsg_amqp1_pip_packages, []) }}
venv_facts_when_changed:
- section: "keystone"
option: "need_db_expand"
value: "True"
- section: "keystone"
option: "need_db_migrate"
value: "True"
- section: "keystone"
option: "need_db_contract"
value: "True"
- section: "keystone"
option: "venv_tag"
value: "{{ keystone_venv_tag }}"