From 5de0b700b58b9d9ef52ecc120360882b163b33a1 Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Thu, 28 Mar 2019 09:35:37 -0400 Subject: [PATCH] Update role for new source build process The variables heat_developer_mode and heat_venv_download no longer carry any meaning. This review changes heat 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 installation 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. Depends-On: https://review.openstack.org/648551 Change-Id: I4b66febefc77176a112486b0e9ee9b46e16cff05 --- defaults/main.yml | 21 +++------------ tasks/heat_install.yml | 17 ++++++++++-- tasks/heat_install_source.yml | 50 ----------------------------------- 3 files changed, 19 insertions(+), 69 deletions(-) delete mode 100644 tasks/heat_install_source.yml diff --git a/defaults/main.yml b/defaults/main.yml index c93a47b..0cd1143 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -38,30 +38,17 @@ heat_install_method: "source" heat_git_repo: https://git.openstack.org/openstack/heat heat_git_install_branch: master -heat_developer_mode: false -heat_developer_constraints: +heat_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')) }}" +heat_git_constraints: - "git+{{ heat_git_repo }}@{{ heat_git_install_branch }}#egg=openstack-heat" + - "--constraint {{ heat_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. -heat_pip_install_args: >- - {{ heat_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('') }} +heat_pip_install_args: "{{ pip_install_options | default('') }}" # Name of the virtual env to deploy into heat_venv_tag: "{{ venv_tag | default('untagged') }}" heat_bin: "{{ _heat_bin }}" -# venv_download, even when true, will use the fallback method of building the -# venv from scratch if the venv download fails. -heat_venv_download: "{{ not heat_developer_mode | bool }}" -heat_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/heat.tgz - heat_fatal_deprecations: False heat_clients_endpoint: internalURL diff --git a/tasks/heat_install.yml b/tasks/heat_install.yml index cac2cd8..a40a5db 100644 --- a/tasks/heat_install.yml +++ b/tasks/heat_install.yml @@ -36,6 +36,19 @@ retries: 5 delay: 2 -- name: Install heat packages from PIP - include_tasks: heat_install_source.yml +- name: Install the python venv + import_role: + name: "python_venv_build" + vars: + venv_build_constraints: "{{ heat_git_constraints }}" + venv_install_destination_path: "{{ heat_bin | dirname }}" + venv_install_distro_package_list: "{{ heat_distro_packages }}" + venv_pip_install_args: "{{ heat_pip_install_args }}" + venv_pip_packages: >- + {{ heat_pip_packages | union(heat_user_pip_packages) + + (heat_oslomsg_amqp1_enabled | bool) | ternary(heat_optional_oslomsg_amqp1_pip_packages, []) }} + venv_facts_when_changed: + - section: "heat" + option: "venv_tag" + value: "{{ heat_venv_tag }}" when: heat_install_method == 'source' diff --git a/tasks/heat_install_source.yml b/tasks/heat_install_source.yml deleted file mode 100644 index 87c5746..0000000 --- a/tasks/heat_install_source.yml +++ /dev/null @@ -1,50 +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 heat_developer_constraints %} - {{ item }} - {% endfor %} - when: heat_developer_mode | bool - -- name: Ensure remote wheel building is disabled in developer mode - set_fact: - venv_build_host: "{{ inventory_hostname }}" - when: - - heat_developer_mode | bool - -- name: Install the python venv - include_role: - name: "python_venv_build" - vars: - venv_install_destination_path: "{{ heat_bin | dirname }}" - venv_install_distro_package_list: "{{ heat_distro_packages }}" - venv_pip_install_args: "{{ heat_pip_install_args }}" - venv_pip_packages: >- - {{ heat_pip_packages | union(heat_user_pip_packages) + - (heat_oslomsg_amqp1_enabled | bool) | ternary(heat_optional_oslomsg_amqp1_pip_packages, []) }} - venv_facts_when_changed: - - section: "heat" - option: "venv_tag" - value: "{{ heat_venv_tag }}"