Simplify pip options/constraints mechanism

The current constraints generation for the
installation involves multiple tasks and multiple
variables.

Using multiple tasks extends the installation time
unnecessarily and the additional variables are
unnecessary.

This patch aims to simplify the mechanism and
hopes to speed it up a little.

Change-Id: Ic7b9237a220344454fa449fff876c3aedd7c57d7
This commit is contained in:
Jesse Pretorius 2016-11-02 18:13:27 +00:00
parent 0d0c6671d9
commit a37d0dcbe2
3 changed files with 22 additions and 25 deletions

View File

@ -26,8 +26,6 @@ tempest_run: False
tempest_git_repo: https://git.openstack.org/openstack/tempest
tempest_git_install_branch: master
tempest_requirements_git_repo: https://git.openstack.org/openstack/requirements
tempest_requirements_git_install_branch: master
tempest_developer_mode: False
tempest_developer_constraints:
- "git+{{ tempest_git_repo }}@{{ tempest_git_install_branch }}#egg=tempest"

View File

@ -0,0 +1,7 @@
---
upgrade:
- The variables ``tempest_requirements_git_repo`` and
``tempest_requirements_git_install_branch`` have been
removed in favour of using the URL/path to the
upper-constraints file using the
variable ``pip_install_upper_constraints`` instead.

View File

@ -30,30 +30,13 @@
{% endfor %}
when: tempest_developer_mode | bool
- name: Clone requirements git repository
git:
repo: "{{ tempest_requirements_git_repo }}"
dest: "/opt/requirements"
clone: yes
update: yes
version: "{{ tempest_requirements_git_install_branch }}"
when: tempest_developer_mode | bool
- name: Add constraints to pip_install_options fact for developer mode
set_fact:
pip_install_options_fact: "{{ pip_install_options|default('') }} --constraint /opt/developer-pip-constraints.txt --constraint /opt/requirements/upper-constraints.txt"
when: tempest_developer_mode | bool
- name: Set pip_install_options_fact when not in developer mode
set_fact:
pip_install_options_fact: "{{ pip_install_options|default('') }}"
when: not tempest_developer_mode | bool
- name: Install requires pip packages
pip:
name: "{{ tempest_requires_pip_packages | join(' ') }}"
state: "{{ tempest_pip_package_state }}"
extra_args: "{{ pip_install_options_fact }}"
extra_args: >-
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
{{ pip_install_options | default('') }}
register: install_packages
until: install_packages|success
retries: 5
@ -137,7 +120,10 @@
state: "{{ tempest_pip_package_state }}"
virtualenv: "{{ tempest_venv_bin | dirname }}"
virtualenv_site_packages: "no"
extra_args: "{{ pip_install_options_fact }}"
extra_args: >-
{{ tempest_developer_mode | ternary('--constraint /opt/developer-pip-constraints.txt', '') }}
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
{{ pip_install_options | default('') }}
register: install_packages
until: install_packages|success
retries: 5
@ -175,7 +161,10 @@
state: "{{ tempest_pip_package_state }}"
virtualenv: "{{ tempest_venv_bin | dirname }}"
virtualenv_site_packages: "no"
extra_args: "{{ pip_install_options_fact }}"
extra_args: >-
{{ tempest_developer_mode | ternary('--constraint /opt/developer-pip-constraints.txt', '') }}
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
{{ pip_install_options | default('') }}
with_items: "{{ _test_requirements_stat.results }}"
when: "{{ item.stat.exists }}"
register: install_tempest_plugin_requirements
@ -189,7 +178,10 @@
state: "{{ tempest_pip_package_state }}"
virtualenv: "{{ tempest_venv_bin | dirname }}"
virtualenv_site_packages: "no"
extra_args: "{{ pip_install_options_fact }}"
extra_args: >-
{{ tempest_developer_mode | ternary('--constraint /opt/developer-pip-constraints.txt', '') }}
{{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''),'') }}
{{ pip_install_options | default('') }}
with_items: "{{ tempest_plugins }}"
register: install_tempest_plugins
until: install_tempest_plugins | success