diff --git a/defaults/main.yml b/defaults/main.yml index ebf19ef6..2b205410 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -42,32 +42,18 @@ swift_git_install_branch: master swift_swift3_git_repo: https://git.openstack.org/openstack/swift3 swift_swift3_git_install_branch: master -# Developer mode settings -swift_developer_mode: false -swift_developer_constraints: +swift_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')) }}" +swift_git_constraints: - "git+{{ swift_git_repo }}@{{ swift_git_install_branch }}#egg=swift" - "git+{{ swift_swift3_git_repo }}@{{ swift_swift3_git_install_branch }}#egg=swift3" + - "--constraint {{ swift_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. -swift_pip_install_args: >- - {{ swift_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('') }} +swift_pip_install_args: "{{ pip_install_options | default('') }}" # Name of the virtual env to deploy into swift_venv_tag: "{{ venv_tag | default('untagged') }}" swift_bin: "{{ _swift_bin }}" -# venv_download, even when true, will use the fallback method of building the -# venv from scratch if the venv download fails. -swift_venv_download: "{{ not swift_developer_mode | bool and not swift_pypy_enabled | bool }}" -swift_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/swift.tgz - # Set the full path to the swift recon cron recon_cron_path: "{{ swift_bin }}/swift-recon-cron" diff --git a/tasks/swift_install.yml b/tasks/swift_install.yml index 86d484c7..6a191087 100644 --- a/tasks/swift_install.yml +++ b/tasks/swift_install.yml @@ -36,8 +36,19 @@ retries: 5 delay: 2 -- name: Install swift packages from PIP - include_tasks: swift_install_source.yml +- name: Install the python venv + import_role: + name: "python_venv_build" + vars: + venv_build_constraints: "{{ swift_git_constraints }}" + venv_build_distro_package_list: "{{ swift_devel_distro_packages }}" + venv_install_destination_path: "{{ swift_bin | dirname }}" + venv_pip_install_args: "{{ swift_pip_install_args }}" + venv_pip_packages: "{{ swift_pip_packages }}" + venv_facts_when_changed: + - section: "swift" + option: "venv_tag" + value: "{{ swift_venv_tag }}" when: swift_install_method == 'source' - include_tasks: swift_pypy_setup.yml diff --git a/tasks/swift_install_source.yml b/tasks/swift_install_source.yml deleted file mode 100644 index 6bc72dfa..00000000 --- a/tasks/swift_install_source.yml +++ /dev/null @@ -1,50 +0,0 @@ ---- -# Copyright 2018, SUSE Linux GmbH. -# -# 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 swift_developer_constraints %} - {{ item }} - {% endfor %} - when: - - swift_developer_mode | bool - -- name: Ensure remote wheel building is disabled in developer mode - set_fact: - venv_build_host: "{{ ansible_hostname }}" - when: - - swift_developer_mode | bool - -- name: Install the python venv - include_role: - name: "python_venv_build" - private: yes - vars: - venv_build_distro_package_list: "{{ swift_devel_distro_packages }}" - venv_install_destination_path: "{{ swift_bin | dirname }}" - venv_pip_install_args: "{{ swift_pip_install_args }}" - venv_pip_packages: "{{ swift_pip_packages }}" - venv_facts_when_changed: - - section: "swift" - option: "venv_tag" - value: "{{ swift_venv_tag }}"