diff --git a/scripts/bootstrap-ansible.sh b/scripts/bootstrap-ansible.sh index 1fb8ef7a18..837f261b59 100755 --- a/scripts/bootstrap-ansible.sh +++ b/scripts/bootstrap-ansible.sh @@ -159,7 +159,6 @@ virtualenv --python=${PYTHON_EXEC_PATH} \ get_pip /opt/ansible-runtime/bin/python2 # The vars used to prepare the Ansible runtime venv -PIP_COMMAND="/opt/ansible-runtime/bin/pip" PIP_OPTS+=" --constraint global-requirement-pins.txt" PIP_OPTS+=" --constraint ${UPPER_CONSTRAINTS_FILE}" diff --git a/scripts/gate-check-commit.sh b/scripts/gate-check-commit.sh index 59a5c120f5..e9a65205e3 100755 --- a/scripts/gate-check-commit.sh +++ b/scripts/gate-check-commit.sh @@ -103,24 +103,8 @@ fi # Bootstrap Ansible source "${OSA_CLONE_DIR}/scripts/bootstrap-ansible.sh" -# Install ARA and add it to the callback path provided by bootstrap-ansible.sh/openstack-ansible.rc -# This is added *here* instead of bootstrap-ansible so it's used for CI purposes only. -ARA_SRC_HOME="${HOME}/src/git.openstack.org/openstack/ara" -if [[ -d "${ARA_SRC_HOME}" ]]; then - # This installs from a git checkout - # PIP_COMMAND and PIP_OPTS are exported by the bootstrap-ansible script. - # PIP_OPTS contains the whole set of constraints that need to be applied. - ${PIP_COMMAND} install --isolated ${PIP_OPTS} ${ARA_SRC_HOME} "${ANSIBLE_PACKAGE:-ansible}" -else - # This installs from pypi - # PIP_COMMAND and PIP_OPTS are exported by the bootstrap-ansible script. - # PIP_OPTS contains the whole set of constraints that need to be applied. - ${PIP_COMMAND} install --isolated ${PIP_OPTS} ara==0.15.0 "${ANSIBLE_PACKAGE:-ansible}" -fi -# Dynamically retrieve the location of the ARA callback so we are able to find -# it on both py2 and py3 -ara_location=$(/opt/ansible-runtime/bin/python -c "import os,ara; print(os.path.dirname(ara.__file__))") -export ANSIBLE_CALLBACK_PLUGINS="/etc/ansible/roles/plugins/callback:${ara_location}/plugins/callbacks" +# Install and export the ARA callback plugin +setup_ara # Log some data about the instance and the rest of the system log_instance_info diff --git a/scripts/scripts-library.sh b/scripts/scripts-library.sh index 062fb15e0f..04f7f90410 100755 --- a/scripts/scripts-library.sh +++ b/scripts/scripts-library.sh @@ -22,6 +22,9 @@ ANSIBLE_PARAMETERS=${ANSIBLE_PARAMETERS:-""} STARTTIME="${STARTTIME:-$(date +%s)}" COMMAND_LOGS=${COMMAND_LOGS:-"/openstack/log/ansible_cmd_logs"} +# The vars used to prepare the Ansible runtime venv +PIP_COMMAND="/opt/ansible-runtime/bin/pip" + ZUUL_PROJECT="${ZUUL_PROJECT:-}" GATE_EXIT_LOG_COPY="${GATE_EXIT_LOG_COPY:-false}" GATE_EXIT_LOG_GZIP="${GATE_EXIT_LOG_GZIP:-true}" @@ -207,6 +210,27 @@ function gate_job_exit_tasks { fi } +function setup_ara { + # Install ARA and add it to the callback path provided by bootstrap-ansible.sh/openstack-ansible.rc + # This is added *here* instead of bootstrap-ansible so it's used for CI purposes only. + ARA_SRC_HOME="${HOME}/src/git.openstack.org/openstack/ara" + if [[ -d "${ARA_SRC_HOME}" ]]; then + # This installs from a git checkout + # PIP_COMMAND and PIP_OPTS are exported by the bootstrap-ansible script. + # PIP_OPTS contains the whole set of constraints that need to be applied. + ${PIP_COMMAND} install --isolated ${PIP_OPTS} ${ARA_SRC_HOME} "${ANSIBLE_PACKAGE:-ansible}" + else + # This installs from pypi + # PIP_COMMAND and PIP_OPTS are exported by the bootstrap-ansible script. + # PIP_OPTS contains the whole set of constraints that need to be applied. + ${PIP_COMMAND} install --isolated ${PIP_OPTS} ara==0.15.0 "${ANSIBLE_PACKAGE:-ansible}" + fi + # Dynamically retrieve the location of the ARA callback so we are able to find + # it on both py2 and py3 + ara_location=$(/opt/ansible-runtime/bin/python -c "import os,ara; print(os.path.dirname(ara.__file__))") + export ANSIBLE_CALLBACK_PLUGINS="/etc/ansible/roles/plugins/callback:${ara_location}/plugins/callbacks" +} + function run_dstat { if [ "$GATE_EXIT_RUN_DSTAT" == true ]; then case ${DISTRO_ID} in