From e62b66dcf861b24f5d717e98e1c49e83a432034b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Steinm=C3=BCller?= Date: Wed, 27 Mar 2019 20:10:44 +0000 Subject: [PATCH] Update role for new source build process The variables octavia_developer_mode and octavia_venv_download no longer carry any meaning. This review changes octavia 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. Change-Id: I8ec47384778732a1e40392c843d02ea990b85c27 --- defaults/main.yml | 21 ++++++----------- tasks/main.yml | 15 +++++++++++- tasks/octavia_install.yml | 49 --------------------------------------- 3 files changed, 21 insertions(+), 64 deletions(-) delete mode 100644 tasks/octavia_install.yml diff --git a/defaults/main.yml b/defaults/main.yml index e3b15a0c..d3e6e33f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -45,27 +45,17 @@ octavia_pip_package_state: "latest" octavia_git_repo: https://git.openstack.org/openstack/octavia octavia_git_install_branch: master -octavia_developer_mode: false -octavia_developer_constraints: +octavia_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')) }}" +octavia_git_constraints: - "git+{{ octavia_git_repo }}@{{ octavia_git_install_branch }}#egg=octavia" + - "--constraint {{ octavia_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. -octavia_pip_install_args: >- - {{ octavia_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('') }} +octavia_pip_install_args: "{{ pip_install_options | default('') }}" # Name of the virtual env to deploy into octavia_venv_tag: "{{ venv_tag | default('untagged') }}" octavia_bin: "/openstack/venvs/octavia-{{ octavia_venv_tag }}/bin" -octavia_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/octavia.tgz - octavia_clients_endpoint: internalURL octavia_auth_strategy: keystone @@ -169,6 +159,9 @@ octavia_pip_packages: - shade - uwsgi +# Specific pip packages provided by the user +octavia_user_pip_packages: [] + octavia_optional_oslomsg_amqp1_pip_packages: - oslo.messaging[amqp1] diff --git a/tasks/main.yml b/tasks/main.yml index f1fa9cdf..fb6a62e7 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -42,7 +42,20 @@ tags: - octavia-install -- include_tasks: octavia_install.yml +- name: Install the python venv + import_role: + name: "python_venv_build" + vars: + venv_build_constraints: "{{ octavia_git_constraints }}" + venv_install_destination_path: "{{ octavia_bin | dirname }}" + venv_install_distro_package_list: "{{ octavia_distro_packages }}" + venv_pip_install_args: "{{ octavia_pip_install_args }}" + venv_pip_packages: "{{ octavia_pip_packages | union(octavia_user_pip_packages) + + (octavia_oslomsg_amqp1_enabled | bool) | ternary(octavia_optional_oslomsg_amqp1_pip_packages, []) }}" + venv_facts_when_changed: + - section: "octavia" + option: "venv_tag" + value: "{{ octavia_venv_tag }}" tags: - octavia-install diff --git a/tasks/octavia_install.yml b/tasks/octavia_install.yml deleted file mode 100644 index cf03f52b..00000000 --- a/tasks/octavia_install.yml +++ /dev/null @@ -1,49 +0,0 @@ ---- -# Copyright 2017, 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 octavia_developer_constraints %} - {{ item }} - {% endfor %} - when: octavia_developer_mode | bool - -- name: Ensure remote wheel building is disabled in developer mode - set_fact: - venv_build_host: "{{ ansible_hostname }}" - when: - - octavia_developer_mode | bool - -- name: Install the python venv - include_role: - name: "python_venv_build" - private: yes - vars: - venv_install_destination_path: "{{ octavia_bin | dirname }}" - venv_install_distro_package_list: "{{ octavia_distro_packages }}" - venv_pip_install_args: "{{ octavia_pip_install_args }}" - venv_pip_packages: "{{ (octavia_oslomsg_amqp1_enabled | bool) | ternary(octavia_pip_packages + octavia_optional_oslomsg_amqp1_pip_packages, octavia_pip_packages) }}" - venv_facts_when_changed: - - section: "octavia" - option: "venv_tag" - value: "{{ octavia_venv_tag }}"