Update role for new source build process

The variables blazar_developer_mode and blazar_venv_download
no longer carry any meaning. This review changes blazar 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.

It looks like the project now needs authentication for the root
of the host so we'll test for that instead of 204.

Change-Id: Id1dc8d378cb57d6ab2b59da76468a4a0859466b1
This commit is contained in:
Mohammed Naser 2019-03-26 13:36:38 -04:00
parent cb561cc870
commit 4b0a53b3a3
4 changed files with 21 additions and 71 deletions

View File

@ -25,29 +25,16 @@ blazar_pip_package_state: latest
blazar_git_repo: https://git.openstack.org/openstack/blazar
blazar_git_install_branch: master
blazar_developer_mode: false
blazar_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')) }}"
# Enable/Disable Ceilometer
blazar_ceilometer_enabled: False
# 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.
blazar_pip_install_args: >-
{{ blazar_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('') }}
blazar_pip_install_args: "{{ pip_install_options | default('') }}"
blazar_venv_tag: "{{ venv_tag | default('untagged') }}"
blazar_bin: "/openstack/venvs/blazar-{{ blazar_venv_tag }}/bin"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
blazar_venv_download: "{{ not blazar_developer_mode | bool }}"
blazar_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/blazar.tgz
blazar_etc_dir: /etc/blazar
blazar_config_option: "--config-file {{ blazar_etc_dir }}/blazar.conf"
@ -60,9 +47,10 @@ blazar_pip_packages:
- python-blazarclient
- systemd-python
## blazar developer constraint
blazar_developer_constraints:
## blazar constraints
blazar_git_constraints:
- "git+{{ blazar_git_repo }}@{{ blazar_git_install_branch }}#egg=blazar"
- "--constraint {{ blazar_upper_constraints_url }}"
## System info
blazar_system_user_name: blazar

View File

@ -1,51 +0,0 @@
---
# Copyright 2018, taseer94@gmail.com
# All rights reserved.
#
# 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 blazar_developer_constraints %}
{{ item }}
{% endfor %}
when: blazar_developer_mode | bool
- name: Ensure remote wheel building is disabled in developer mode
set_fact:
venv_build_host: "{{ ansible_hostname }}"
when:
- blazar_developer_mode | bool
- name: Install the python venv
include_role:
name: "python_venv_build"
private: yes
vars:
venv_build_distro_package_list: "{{ blazar_devel_distro_packages }}"
venv_install_destination_path: "{{ blazar_bin | dirname }}"
venv_install_distro_package_list: "{{ blazar_distro_packages }}"
venv_pip_install_args: "{{ blazar_pip_install_args }}"
venv_pip_packages: "{{ blazar_pip_packages }}"
venv_facts_when_changed:
- section: "blazar"
option: "venv_tag"
value: "{{ blazar_venv_tag }}"

View File

@ -30,7 +30,20 @@
tags:
- blazar-install
- include_tasks: blazar_install.yml
- name: Install the python venv
import_role:
name: "python_venv_build"
vars:
venv_build_constraints: "{{ blazar_git_constraints }}"
venv_build_distro_package_list: "{{ blazar_devel_distro_packages }}"
venv_install_destination_path: "{{ blazar_bin | dirname }}"
venv_install_distro_package_list: "{{ blazar_distro_packages }}"
venv_pip_install_args: "{{ blazar_pip_install_args }}"
venv_pip_packages: "{{ blazar_pip_packages }}"
venv_facts_when_changed:
- section: "blazar"
option: "venv_tag"
value: "{{ blazar_venv_tag }}"
tags:
- blazar-install

View File

@ -21,8 +21,8 @@
- name: check blazar api
uri:
url: http://localhost:1234
status_code: 204
status_code: 401
register: result
until: result.status == 204
until: result.status == 401
retries: 5
delay: 10