Set nodepool mirror PIP_OPTS consistently

The bootstrap-ansible script does not always run as a child of the
gate-check-commit, so bootstrap-ansible should be prepared to load
the nodepool PIP mirrors itself. Move the nodepool mirror detection
into a common function so it can be used in both bootstrap-ansible
and gate-check-commit.

Change-Id: Ie5c8d65aee11d6dba18a0388467783cc6e9e5d36
This commit is contained in:
Logan V 2019-05-12 19:22:30 -05:00
parent d8a03801c2
commit bd36689c2c
3 changed files with 13 additions and 10 deletions

View File

@ -97,6 +97,9 @@ esac
# Ensure that our shell knows about the new virtualenv
hash -r virtualenv
# Load nodepool PIP mirror settings
load_nodepool_pip_opts
# Ensure we use the HTTPS/HTTP proxy with pip if it is specified
if [ -n "$HTTPS_PROXY" ]; then
PIP_OPTS+="--proxy $HTTPS_PROXY"

View File

@ -81,11 +81,7 @@ log_instance_info
run_dstat || true
# If in OpenStack-Infra, set some vars to use the mirror when bootstrapping Ansible
if [[ -e /etc/ci/mirror_info.sh ]]; then
source /etc/ci/mirror_info.sh
export PIP_OPTS="--index-url ${NODEPOOL_PYPI_MIRROR} --trusted-host ${NODEPOOL_MIRROR_HOST} --extra-index-url ${NODEPOOL_WHEEL_MIRROR}"
fi
load_nodepool_pip_opts
# Bootstrap Ansible
source "${OSA_CLONE_DIR}/scripts/bootstrap-ansible.sh"
@ -169,11 +165,7 @@ if [[ "${ACTION}" == "upgrade" ]]; then
unset UPPER_CONSTRAINTS_FILE
unset PIP_OPTS
# If in OpenStack-Infra, set some vars to use the mirror when bootstrapping Ansible
if [[ -e /etc/ci/mirror_info.sh ]]; then
source /etc/ci/mirror_info.sh
export PIP_OPTS="--index-url ${NODEPOOL_PYPI_MIRROR} --trusted-host ${NODEPOOL_MIRROR_HOST} --extra-index-url ${NODEPOOL_WHEEL_MIRROR}"
fi
load_nodepool_pip_opts
# Source the current scripts-library.sh functions
source "${OSA_CLONE_DIR}/scripts/scripts-library.sh"

View File

@ -92,6 +92,14 @@ function build_ansible_runtime_venv {
fi
}
# If in OpenStack-Infra, set some vars to use the mirror when bootstrapping Ansible
function load_nodepool_pip_opts {
if [[ -e /etc/ci/mirror_info.sh ]]; then
source /etc/ci/mirror_info.sh
export PIP_OPTS="--index-url ${NODEPOOL_PYPI_MIRROR} --trusted-host ${NODEPOOL_MIRROR_HOST} --extra-index-url ${NODEPOOL_WHEEL_MIRROR}"
fi
}
# Determine the distribution we are running on, so that we can configure it
# appropriately.
function determine_distro {