Add ability to set upper constraints file

When this role executes the installation of packages
for SNI support it should also respect upper constraints.

This patch adds the ability to set an upper constraint
file URL/path.

The tox config is also adjusted to ensure that it makes
use of upper constraints when installing requirements.

Change-Id: I2ab6f55096b560a7b443de412df168e26a3eca07
This commit is contained in:
Jesse Pretorius 2016-10-18 16:11:20 +01:00
parent c45165acd3
commit 92fbfc238d
4 changed files with 17 additions and 4 deletions

View File

@ -32,6 +32,9 @@ pip_tmp_packages: /tmp/pip_install
pip_get_pip_options: ""
pip_source_install_options: ""
# The URL/path of a constraints file to use when installing the additional pip packages.
#pip_install_upper_constraints: "http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt"
# This list var can be used to specify specific versions of pip, setuptools,
# wheel and any other packages which must be installed when pip installs.
pip_packages:

View File

@ -35,23 +35,32 @@
retries: 3
delay: 2
- name: Set pip_install_options_fact (with upper constraints)
set_fact:
pip_install_options_fact: "--constraint {{ pip_install_upper_constraints }} {{ pip_install_options }}"
when: pip_install_upper_constraints is defined
- name: Set pip_install_options_fact (without upper constraints)
set_fact:
pip_install_options_fact: "{{ pip_install_options }}"
when: pip_install_upper_constraints is not defined
- name: Install pip packages
pip:
name: "{{ pip_required_pip_packages | map('quote') | join(' ') }}"
state: latest
extra_args: "{{ pip_install_options }}"
extra_args: "{{ pip_install_options_fact }}"
failed_when: false
register: install_packages
until: install_packages | success
retries: 5
delay: 2
- name: Install pip packages (fall back mode)
pip:
name: "{{ pip_required_pip_packages | map('quote') | join(' ') }}"
state: latest
extra_args: "--isolated {{ pip_install_options }}"
extra_args: "--isolated {{ pip_install_options_fact }}"
when: install_packages | failed
register: install_packages_fall_back
until: install_packages_fall_back | success

View File

@ -19,6 +19,7 @@
vars:
pip_packages:
- "pip==8.0.3"
pip_install_upper_constraints: "http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt"
roles:
- role: "pip_install"
post_tasks:

View File

@ -107,7 +107,7 @@ commands =
# it doesn't work in OpenStack-CI yet. Once that's fixed, we can
# drop the install_command.
install_command =
pip install -U --force-reinstall {opts} {packages}
pip install -c https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt {opts} {packages}
[testenv:functional]