Skip to content

Commit

Permalink
Update role for new source build process
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Jesse Pretorius committed Mar 20, 2019
1 parent 9539f40 commit 522bba6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 80 deletions.
21 changes: 4 additions & 17 deletions defaults/main.yml
Expand Up @@ -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') }}"
Expand All @@ -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

Expand Down
23 changes: 21 additions & 2 deletions tasks/glance_install.yml
Expand Up @@ -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
Expand Down
59 changes: 0 additions & 59 deletions tasks/glance_install_source.yml

This file was deleted.

4 changes: 2 additions & 2 deletions tasks/main.yml
Expand Up @@ -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

Expand Down

0 comments on commit 522bba6

Please sign in to comment.