Update role for new source build process

The variables sahara_developer_mode and sahara_venv_download
no longer carry any meaning. This review changes sahara 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: I74f5fa25b70fbb5c514af3a72b5b6654d5c8e24d
This commit is contained in:
Guilherme Steinmüller 2019-03-26 18:12:58 +00:00
parent f92957d42b
commit cb1098d25c
4 changed files with 24 additions and 66 deletions

View File

@ -27,20 +27,12 @@ sahara_pip_package_state: "latest"
sahara_git_repo: https://git.openstack.org/openstack/sahara
sahara_git_install_branch: master
sahara_developer_mode: false
sahara_developer_constraints:
sahara_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')) }}"
sahara_git_constraints:
- "git+{{ sahara_git_repo }}@{{ sahara_git_install_branch }}#egg=sahara"
- "--constraint {{ sahara_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.
sahara_pip_install_args: >-
{{ sahara_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('') }}
sahara_pip_install_args: "{{ pip_install_options | default('') }}"
# Name of the virtual env to deploy into
sahara_venv_tag: "{{ venv_tag | default('untagged') }}"
@ -48,11 +40,6 @@ sahara_bin: "/openstack/venvs/sahara-{{ sahara_venv_tag }}/bin"
sahara_etc_dir: "{{ sahara_bin | dirname }}/etc/sahara"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
sahara_venv_download: "{{ not sahara_developer_mode | bool }}"
sahara_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/sahara.tgz
sahara_db_config: /etc/sahara/sahara.conf
# Enable/Disable Ceilometer
@ -200,6 +187,9 @@ sahara_pip_packages:
sahara_optional_oslomsg_amqp1_pip_packages:
- oslo.messaging[amqp1]
# Specific pip packages provided by the user
sahara_user_pip_packages: []
sahara_engine_init_overrides: {}
sahara_api_init_overrides: {}

View File

@ -27,7 +27,23 @@
tags:
- sahara-install
- include_tasks: sahara_install.yml
- name: Install the python venv
import_role:
name: "python_venv_build"
vars:
venv_build_constraints: "{{ sahara_git_constraints }}"
venv_install_destination_path: "{{ sahara_bin | dirname }}"
venv_install_distro_package_list: "{{ sahara_distro_packages }}"
venv_pip_install_args: "{{ sahara_pip_install_args }}"
venv_pip_packages: >-
{{ sahara_pip_packages |
union(sahara_user_pip_packages) |
union(sahara_plugin_pip_packages) |
union(((sahara_oslomsg_amqp1_enabled | bool) | ternary(sahara_optional_oslomsg_amqp1_pip_packages, [])))}}
venv_facts_when_changed:
- section: "sahara"
option: "venv_tag"
value: "{{ sahara_venv_tag }}"
tags:
- sahara-install

View File

@ -1,47 +0,0 @@
---
# 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 sahara_developer_constraints %}
{{ item }}
{% endfor %}
when:
- sahara_developer_mode | bool
- name: Ensure remote wheel building is disabled in developer mode
set_fact:
venv_build_host: "{{ ansible_hostname }}"
when:
- sahara_developer_mode | bool
- name: Install the python venv
include_role:
name: "python_venv_build"
vars:
venv_install_destination_path: "{{ sahara_bin | dirname }}"
venv_install_distro_package_list: "{{ sahara_distro_packages }}"
venv_pip_install_args: "{{ sahara_pip_install_args }}"
venv_pip_packages: "{{ (sahara_oslomsg_amqp1_enabled | bool) | ternary(sahara_pip_packages + sahara_plugin_pip_packages + sahara_optional_oslomsg_amqp1_pip_packages, sahara_pip_packages + sahara_plugin_pip_packages) }}"
venv_facts_when_changed:
- section: "sahara"
option: "venv_tag"
value: "{{ sahara_venv_tag }}"

View File

@ -23,7 +23,6 @@ tempest_plugins:
tempest_test_whitelist:
- sahara_tempest_plugin.tests.api
sahara_developer_mode: true
sahara_service_password: "secrete"
sahara_container_mysql_password: "SuperSecrete"
sahara_oslomsg_rpc_password: "{{ oslomsg_rpc_password }}"