Update role for new source build process

The variables glance_developer_mode and glance_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.

We also change include_tasks to import_tasks and include_role
to import_role so that the tags in the python_venv_build role
will work.

Depends-On: https://review.openstack.org/620339
Depends-On: https://review.openstack.org/637240
Depends-On: https://review.openstack.org/637503
Depends-On: https://review.openstack.org/644391
Change-Id: I1e5bd71b164676031fcde9890be43554e67048bf
This commit is contained in:
Jesse Pretorius 2018-11-27 14:40:23 +00:00
parent 9539f40f7c
commit 522bba6f30
4 changed files with 27 additions and 80 deletions

View File

@ -32,20 +32,12 @@ glance_pip_package_state: "latest"
glance_git_repo: https://git.openstack.org/openstack/glance
glance_git_install_branch: master
glance_developer_mode: false
glance_developer_constraints:
glance_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')) }}"
glance_git_constraints:
- "git+{{ glance_git_repo }}@{{ glance_git_install_branch }}#egg=glance"
- "--constraint {{ glance_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.
glance_pip_install_args: >-
{{ glance_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('') }}
glance_pip_install_args: "{{ pip_install_options | default('') }}"
# Name of the virtual env to deploy into
glance_venv_tag: "{{ venv_tag | default('untagged') }}"
@ -57,11 +49,6 @@ glance_bin: "{{ _glance_bin }}"
# glance_etc_dir: "/usr/local/etc/glance"
glance_etc_dir: "/etc/glance"
# venv_download, even when true, will use the fallback method of building the
# venv from scratch if the venv download fails.
glance_venv_download: "{{ not glance_developer_mode | bool }}"
glance_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/glance.tgz
# Enable/Disable Ceilometer
glance_ceilometer_enabled: False

View File

@ -127,8 +127,27 @@
retries: 5
delay: 2
- name: Install glance packages from PIP
include_tasks: glance_install_source.yml
- name: Install the python venv
import_role:
name: "python_venv_build"
private: yes
vars:
venv_build_constraints: "{{ glance_git_constraints }}"
venv_build_distro_package_list: "{{ glance_devel_distro_packages }}"
venv_install_destination_path: "{{ glance_bin | dirname }}"
venv_install_distro_package_list: "{{ glance_distro_packages }}"
venv_pip_install_args: "{{ glance_pip_install_args }}"
venv_pip_packages: >-
{{ glance_pip_packages |
union(glance_user_pip_packages) |
union(((glance_oslomsg_amqp1_enabled | bool) | ternary(glance_optional_oslomsg_amqp1_pip_packages, []))) }}
venv_facts_when_changed:
- section: "glance"
option: "need_service_restart"
value: True
- section: "glance"
option: "venv_tag"
value: "{{ glance_venv_tag }}"
when: glance_install_method == 'source'
- name: Record the need for a service restart

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 glance_developer_constraints %}
{{ item }}
{% endfor %}
when: glance_developer_mode | bool
- name: Ensure remote wheel building is disabled in developer mode
set_fact:
venv_build_host: "{{ inventory_hostname }}"
when:
- glance_developer_mode | bool
- name: Install the python venv
include_role:
name: "python_venv_build"
vars:
venv_build_distro_package_list: "{{ glance_devel_distro_packages }}"
venv_install_destination_path: "{{ glance_bin | dirname }}"
venv_install_distro_package_list: "{{ glance_distro_packages }}"
venv_pip_install_args: "{{ glance_pip_install_args }}"
venv_pip_packages: "{{ glance_pip_packages | union(glance_user_pip_packages) +
(glance_oslomsg_amqp1_enabled | bool) | ternary(glance_optional_oslomsg_amqp1_pip_packages, []) }}"
venv_facts_when_changed:
- section: "glance"
option: "need_service_restart"
value: True
- section: "glance"
option: "venv_tag"
value: "{{ glance_venv_tag }}"
- name: Link in the os-brick rootwrap filters
file:
src: "{{ glance_bin | dirname }}/etc/os-brick/rootwrap.d/os-brick.filters"
dest: "{{ glance_etc_dir }}/rootwrap.d/os-brick.filters"
state: link

View File

@ -40,11 +40,11 @@
tags:
- always
- include_tasks: glance_install.yml
- import_tasks: glance_install.yml
tags:
- glance-install
- include_tasks: glance_post_install.yml
- import_tasks: glance_post_install.yml
tags:
- glance-config