Ensure that global-requirement-pins.txt is applied

In the previous repo build process, we had global constraints which
override upper constraints and anything set in the roles. This was
essential for two purposes:

1. To enable us to pin things that were not in upper constraints. eg: pip,
   setuptools, wheel
2. To enable us to pin things which were in upper constraints, but broken.
   This would usually be a temporary measure until upper constraints was
   fixed.

This patch extracts the global pins from global-requirement-pins.txt
into a list and sets 'venv_build_global_constraints' to the resulting
list so that it is applied to all venvs built.

In order to reliably find this file without using a hard-coded path, we
implement a change to the wrapper script to set the path in it in a
similar manner to that implemented for the inventory path.

Depends-On: I9ae3ef19c863b9237a51d2fcd6f4ebce1a9ebad7
Change-Id: I138fe1c8ea80fe71244ab0dc6497cfc6d7bdf953
This commit is contained in:
Jesse Pretorius 2019-04-17 12:25:45 +01:00
parent dc5729ad6f
commit 0635dfbccc
3 changed files with 12 additions and 2 deletions

View File

@ -128,3 +128,9 @@ is_metal: >-
{{ (properties is defined) and
(properties.is_metal is defined) and
(properties.is_metal | bool) }}
_global_pins_file_path: >-
{{ (lookup('env', 'OSA_CLONE_ROOT') | default('/opt/openstack-ansible', true)) ~ '/global-requirement-pins.txt' }}
venv_build_global_constraints: >-
{{ lookup('file', _global_pins_file_path).splitlines() | reject('match','^#.*$') | reject('equalto', '') | list }}

View File

@ -176,8 +176,9 @@ sed -i "s|OSA_PLAYBOOK_PATH|${OSA_PLAYBOOK_PATH}|g" /usr/local/bin/openstack-ans
# Create openstack ansible wrapper tool
cp -v ${OSA_WRAPPER_BIN} /usr/local/bin/openstack-ansible
# Mark the current OSA git repo clone directory, so we don't need to compute it every time.
sed -i "s|OSA_CLONE_DIR|${OSA_CLONE_DIR}|g" /usr/local/bin/openstack-ansible
# Mark the current OSA version in the wrapper, so we don't need to compute it everytime.
# Mark the current OSA version in the wrapper, so we don't need to compute it every time.
sed -i "s|CURRENT_OSA_VERSION|${CURRENT_OSA_VERSION}|g" /usr/local/bin/openstack-ansible
# Ensure wrapper tool is executable

View File

@ -18,7 +18,10 @@
# OpenStack wrapper tool to ease the use of ansible with multiple variable files.
export PATH="/opt/ansible-runtime/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${PATH}"
# These environment variables are used in group_vars
export OSA_VERSION="CURRENT_OSA_VERSION"
export OSA_CLONE_ROOT="OSA_CLONE_DIR"
function info {
if [ "${ANSIBLE_NOCOLOR:-0}" -eq "1" ]; then
@ -32,7 +35,7 @@ function info {
RUN_CMD=$(basename ${0})
# Apply the OpenStack-Ansible configuration selectively.
if [[ "${PWD}" == *"OSA_CLONE_DIR"* ]] || [ "${RUN_CMD}" == "openstack-ansible" ]; then
if [[ "${PWD}" == *"${OSA_CLONE_ROOT}"* ]] || [ "${RUN_CMD}" == "openstack-ansible" ]; then
# Source the Ansible configuration.
. /usr/local/bin/openstack-ansible.rc