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: Iaf085a3f58dde94c3f02a0a6e5161e9e07766db4
This commit is contained in:
Jesse Pretorius 2016-11-02 17:52:17 +00:00
parent e70e6261bd
commit 244a830185
5 changed files with 28 additions and 41 deletions

View File

@ -26,13 +26,9 @@ nova_pip_package_state: "latest"
nova_git_repo: https://git.openstack.org/openstack/nova
nova_git_install_branch: master
nova_requirements_git_repo: https://git.openstack.org/openstack/requirements
nova_requirements_git_install_branch: master
nova_lxd_git_repo: https://git.openstack.org/openstack/nova-lxd
nova_lxd_git_install_branch: master
nova_lxd_requirements_git_repo: https://git.openstack.org/openstack/requirements
nova_lxd_requirements_git_install_branch: master
nova_developer_mode: false
nova_developer_constraints:

View File

@ -0,0 +1,12 @@
---
upgrade:
- The variables ``nova_requirements_git_repo`` and
``nova_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.
- The variables ``nova_lxd_requirements_git_repo`` and
``nova_lxd_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

@ -19,7 +19,10 @@
state: "{{ nova_pip_package_state }}"
virtualenv: "{{ nova_bin | dirname }}"
virtualenv_site_packages: "no"
extra_args: "{{ pip_install_options_fact|default('') }}"
extra_args: >-
{{ nova_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

View File

@ -19,7 +19,10 @@
state: "{{ nova_pip_package_state }}"
virtualenv: "{{ nova_bin | dirname }}"
virtualenv_site_packages: "no"
extra_args: "{{ pip_install_options_fact|default('') }}"
extra_args: >-
{{ nova_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

View File

@ -23,39 +23,7 @@
{% for item in nova_developer_constraints %}
{{ item }}
{% endfor %}
when:
- nova_developer_mode | bool
tags:
- nova-install
- nova-pip-packages
- name: Clone requirements git repository
git:
repo: "{{ nova_requirements_git_repo }}"
dest: "/opt/requirements"
clone: yes
update: yes
version: "{{ nova_requirements_git_install_branch }}"
when:
- nova_developer_mode | bool
tags:
- nova-install
- nova-pip-packages
- 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:
- nova_developer_mode | bool
tags:
- nova-install
- nova-pip-packages
- name: Set pip_install_options_fact when not in developer mode
set_fact:
pip_install_options_fact: "{{ pip_install_options|default('') }}"
when:
- not nova_developer_mode | bool
when: nova_developer_mode | bool
tags:
- nova-install
- nova-pip-packages
@ -64,7 +32,9 @@
pip:
name: "{{ nova_requires_pip_packages | join(' ') }}"
state: "{{ nova_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
@ -160,7 +130,10 @@
state: "{{ nova_pip_package_state }}"
virtualenv: "{{ nova_bin | dirname }}"
virtualenv_site_packages: "no"
extra_args: "{{ pip_install_options_fact }}"
extra_args: >-
{{ nova_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