Update ARA installation and loading

- Allow ARA installation to be disabled in gate-check-commit. For
  backwards compatibility, this remains defaulted to true. However
  in the OSA gate, the pre-run playbook will install ARA so we set
  it to false during the gate-check-commit run rather than waste
  time installing it twice.

- Separate the ARA installation from loading. Continue installing
  ARA using the setup_ara function, but do not load ARA into the
  callback plugins env var there. Instead, we will load ARA into
  the ANSIBLE_CALLBACK_PLUGINS inside the openstack-ansible wrapper
  if it is installed.

- Move ARA installation function call to run right after the
  ansible-runtime venv is created. This makes little difference
  except that ARA will now be installed in time for the
  get-ansible-role-requirements role clone run.

Change-Id: I8ec359f5c65c957064a39b75b9c3ea3d3a9d9e89
This commit is contained in:
Logan V 2019-05-12 19:09:40 -05:00
parent d8a03801c2
commit 13ffd8a459
6 changed files with 18 additions and 10 deletions

View File

@ -120,6 +120,11 @@ if [[ -z "${SKIP_OSA_RUNTIME_VENV_BUILD+defined}" ]]; then
build_ansible_runtime_venv
fi
# Install and export the ARA callback plugin
if [ "${SETUP_ARA}" == "true" ]; then
setup_ara
fi
# Get current code version (this runs at the root of OSA clone)
CURRENT_OSA_VERSION=$(cd ${OSA_CLONE_DIR}; /opt/ansible-runtime/bin/python setup.py --version)
@ -192,9 +197,4 @@ if [ -f "${ANSIBLE_ROLE_FILE}" ] && [[ -z "${SKIP_OSA_ROLE_CLONE+defined}" ]]; t
unset ANSIBLE_CONFIG
fi
# Install and export the ARA callback plugin
if [ "${SETUP_ARA}" == "true" ]; then
setup_ara
fi
echo "System is bootstrapped and ready for use."

View File

@ -55,7 +55,7 @@ export INSTALL_METHOD=${3:-"source"}
export UPGRADE_SOURCE_BRANCH=${UPGRADE_SOURCE_BRANCH:-'stable/rocky'}
# enable the ARA callback plugin
export SETUP_ARA=true
export SETUP_ARA=${SETUP_ARA:-true}
## Change branch for Upgrades ------------------------------------------------
# If the action is to upgrade, then store the current SHA,

View File

@ -40,6 +40,14 @@ if [[ "${PWD}" == *"${OSA_CLONE_ROOT}"* ]] || [ "${RUN_CMD}" == "openstack-ansib
# Source the Ansible configuration.
. /usr/local/bin/openstack-ansible.rc
# Load ARA into callback plugins if it is installed
# Dynamically retrieve the location of the ARA callback so we are able to find
# it on both py2 and py3
ara_location=$(python -c "import os,ara; print(os.path.dirname(ara.__file__))" 2>/dev/null || true)
if [[ -n "$ara_location" ]]; then
export ANSIBLE_CALLBACK_PLUGINS="${ANSIBLE_CALLBACK_PLUGINS}:${ara_location}/plugins/callbacks"
fi
# Load userspace group vars
if [[ -d ${OSA_CONFIG_DIR}/group_vars || -d ${OSA_CONFIG_DIR}/host_vars ]]; then
if [[ ! -f ${OSA_CONFIG_DIR}/inventory.ini ]]; then

View File

@ -203,10 +203,6 @@ function setup_ara {
# PIP_OPTS contains the whole set of constraints that need to be applied.
${PIP_COMMAND} install --isolated ${PIP_OPTS} ara "${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 {

View File

@ -30,6 +30,7 @@
# where the CI provided git sources were cloned.
ZUUL_SRC_PATH: "{{ ansible_user_dir }}/src"
ANSIBLE_PACKAGE: "{{ ansible_package | default('') }}"
SETUP_ARA: 'true'
- name: Run bootstrap-aio script
become: yes
become_user: root

View File

@ -14,6 +14,9 @@
chdir: "src/opendev.org/openstack/openstack-ansible"
executable: /bin/bash
environment:
# NOTE(logan): ARA is already installed in the gate environment by the
# pre-osa-aio pre-run playbook
SETUP_ARA: false
# NOTE(logan): The project is bootstrapped in the pre playbook so the
# bootstrapping can be skipped here
SKIP_OSA_RUNTIME_VENV_BUILD: 1