From 02d49dc5789fd0785e24e2ae12f6c99c50b9056b Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Tue, 26 Mar 2019 13:47:36 -0400 Subject: [PATCH] Update role for new source build process The variables barbican_developer_mode and barbican_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. Depends-On: https://review.openstack.org/647813 Change-Id: Ia3c69c1f8a9487481e1275875701cf3d77c2d231 --- defaults/main.yml | 21 ++++----------------- tasks/cinder_install_source.yml | 29 +++++------------------------ 2 files changed, 9 insertions(+), 41 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 751e575d..9a5cb9bd 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -29,30 +29,17 @@ cinder_install_method: "source" cinder_git_repo: https://git.openstack.org/openstack/cinder cinder_git_install_branch: master -cinder_developer_mode: false -cinder_developer_constraints: +cinder_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')) }}" +cinder_git_constraints: - "git+{{ cinder_git_repo }}@{{ cinder_git_install_branch }}#egg=cinder" + - "--constraint {{ cinder_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. -cinder_pip_install_args: >- - {{ cinder_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('') }} +cinder_pip_install_args: "{{ pip_install_options | default('') }}" # Name of the virtual env to deploy into cinder_venv_tag: "{{ venv_tag | default('untagged') }}" cinder_bin: "{{ _cinder_bin }}" -# venv_download, even when true, will use the fallback method of building the -# venv from scratch if the venv download fails. -cinder_venv_download: "{{ not cinder_developer_mode | bool }}" -cinder_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/cinder.tgz - # Enable/Disable Barbican cinder_barbican_enabled: False diff --git a/tasks/cinder_install_source.yml b/tasks/cinder_install_source.yml index e82a0a44..af8bf82a 100644 --- a/tasks/cinder_install_source.yml +++ b/tasks/cinder_install_source.yml @@ -13,37 +13,18 @@ # 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 cinder_developer_constraints %} - {{ item }} - {% endfor %} - when: cinder_developer_mode | bool - -- name: Ensure remote wheel building is disabled in developer mode - set_fact: - venv_build_host: "{{ inventory_hostname }}" - when: - - cinder_developer_mode | bool - - name: Install the python venv - include_role: + import_role: name: "python_venv_build" vars: + venv_build_constraints: "{{ cinder_git_constraints }}" venv_build_distro_package_list: "{{ cinder_devel_distro_packages }}" venv_install_destination_path: "{{ cinder_bin | dirname }}" venv_pip_install_args: "{{ cinder_pip_install_args }}" venv_pip_packages: >- - {{ cinder_pip_packages | union(cinder_user_pip_packages) + - (cinder_oslomsg_amqp1_enabled | bool) | ternary(cinder_optional_oslomsg_amqp1_pip_packages, []) }} + {{ cinder_pip_packages | + union(cinder_user_pip_packages) | + union(((cinder_oslomsg_amqp1_enabled | bool) | ternary(cinder_optional_oslomsg_amqp1_pip_packages, []))) }} venv_facts_when_changed: - section: "cinder" option: "need_service_restart"