Use the repo if available

Currently a configured pip.conf is required in order to make
use of the repo server in an OSA build. This ensures that it
is used, but not exclusively used, if it is available to source
python packages.

The implementation allows it to still respect any configured pip
configuration on the host, so we should be able to remove the OSA
pip.conf with this in place and still maintain the use of the local
repo.

Change-Id: Ia6f2cf86f77ee380fce2d1ecc89e1cb4341e39df
This commit is contained in:
Jesse Pretorius 2018-11-27 15:15:50 +00:00
parent 8f5ea40a5b
commit 53dea0d306
2 changed files with 12 additions and 0 deletions

View File

@ -63,6 +63,14 @@ venv_build_constraints: []
# Arguments to pass to pip when building the wheels
venv_pip_build_args: ""
# Default arguments to pass to pip when installing into
# the venv.
venv_default_pip_install_args: >-
{%- if (groups['repo_all'] is defined) and (groups['repo_all'] | length > 0) %}
--find-links {{ openstack_repo_url | default('http://localhost') }}/os-releases/{{ openstack_release | default('master') }}/{{ (ansible_distribution | lower) | replace(' ', '_') }}-{{ ansible_distribution_version.split('.')[:2] | join('.') }}-{{ ansible_architecture | lower }}
--trusted-host {{ (openstack_repo_url | default('http://localhost')) | urlsplit('hostname') }}
{%- endif %}
# Arguments to pass to pip when installing into the venv
venv_pip_install_args: ""

View File

@ -98,11 +98,14 @@
virtualenv: "{{ venv_install_destination_path }}"
extra_args: >-
--log /var/log/python_venv_build.log
{{ venv_default_pip_install_args }}
{{ venv_pip_install_args }}
register: _update_virtualenv_packages
until: _update_virtualenv_packages is success
retries: 5
delay: 2
notify:
- venv changed
- name: Install python packages into the venv
pip:
@ -113,6 +116,7 @@
--constraint {{ venv_install_destination_path }}/constraints.txt
--pre
--log /var/log/python_venv_build.log
{{ venv_default_pip_install_args }}
{{ venv_pip_install_args }}
when: (_requirement_file is changed) or (_constraint_file is changed)
register: _install_venv_pip_packages