Update role for new source build process

The variables horizon_developer_mode and horizon_venv_download
no longer carry any meaning. This review changes horizon 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: I8d6e97a690e087c6674e583ed2e6e7fcc754d920
This commit is contained in:
Dmitriy Rabotjagov 2019-03-26 21:23:22 +02:00 committed by Dmitriy Rabotjagov (noonedeadpunk)
parent f2c8cdcf6c
commit 1912e5ae28
2 changed files with 6 additions and 40 deletions

View File

@ -30,8 +30,7 @@ horizon_pip_package_state: "latest"
# Set installation method.
horizon_install_method: "source"
## Toggle developer mode
horizon_developer_mode: false
horizon_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')) }}"
## The git source/branch for Horizon
horizon_git_repo: https://git.openstack.org/openstack/horizon
@ -93,8 +92,8 @@ zun_dashboard_git_install_branch: master
neutron_vpnaas_dashboard_git_repo: https://git.openstack.org/openstack/neutron-vpnaas-dashboard
neutron_vpnaas_dashboard_git_install_branch: master
## The packages to build from source (used in developer mode)
horizon_developer_constraints:
## The packages to build from source
horizon_git_constraints:
- "git+{{ horizon_git_repo }}@{{ horizon_git_install_branch }}#egg=horizon"
- "git+{{ blazar_dashboard_git_repo }}@{{ blazar_dashboard_git_install_branch }}#egg=blazar-dashboard"
- "git+{{ cloudkitty_dashboard_git_repo }}@{{ cloudkitty_dashboard_git_install_branch }}#egg=cloudkitty_dashboard"
@ -109,27 +108,14 @@ horizon_developer_constraints:
- "git+{{ watcher_dashboard_git_repo }}@{{ watcher_dashboard_git_install_branch }}#egg=watcher_dashboard"
- "git+{{ zun_dashboard_git_repo }}@{{ zun_dashboard_git_install_branch }}#egg=zun_ui"
- "git+{{ neutron_vpnaas_dashboard_git_repo }}@{{ neutron_vpnaas_dashboard_git_install_branch }}#egg=neutron_vpnaas_dashboard"
- --constraint {{ horizon_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.
horizon_pip_install_args: >-
{{ horizon_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('') }}
horizon_pip_install_args: "{{ pip_install_options | default('') }}"
# Name of the virtual env to deploy into
horizon_venv_tag: "{{ venv_tag | default('untagged') }}"
horizon_bin: "{{ _horizon_bin }}"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
horizon_venv_download: "{{ not horizon_developer_mode | bool }}"
horizon_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/horizon.tgz
## System info
horizon_system_user_name: horizon
horizon_system_group_name: horizon

View File

@ -37,31 +37,11 @@
- { src: "/var/log/httpd", dest: "/var/log/apache2" }
when: ansible_pkg_mgr in ['yum', 'dnf']
# 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 horizon_developer_constraints %}
{{ item }}
{% endfor %}
when: horizon_developer_mode | bool
- name: Ensure remote wheel building is disabled in developer mode
set_fact:
venv_build_host: "{{ inventory_hostname }}"
when:
- horizon_developer_mode | bool
- name: Install the python venv
include_role:
name: "python_venv_build"
vars:
venv_build_constraints: "{{ horizon_git_constraints }}"
venv_build_distro_package_list: "{{ horizon_devel_distro_packages }}"
venv_install_destination_path: "{{ horizon_bin | dirname }}"
venv_pip_install_args: "{{ horizon_pip_install_args }}"