ARA: Prepare the ARA plugin for all the tests

Right now, ARA is being setup when we are running functional tests.
However, we could use it for other type of tests such as the upgrade
ones. As such, we can setup ARA by default as part of the environment
preparation steps.

Change-Id: I49052809c4970592c40a394a31a4d8eca12116e5
This commit is contained in:
Markos Chandras 2018-01-24 11:37:09 +00:00
parent fd9615fd55
commit 6b127cb2bc
2 changed files with 24 additions and 23 deletions

View File

@ -79,6 +79,28 @@ EOF
}
function setup_ara {
# Don't do anything if ARA has already been set up
[[ -L "${ANSIBLE_PLUGIN_DIR}/callback/ara" ]] && return 0
# Install ARA from source if running in ARA gate, otherwise install from PyPi
ARA_SRC_HOME="${TESTING_HOME}/src/git.openstack.org/openstack/ara"
if [[ -d "${ARA_SRC_HOME}" ]]; then
pip install --constraint "${COMMON_TESTS_PATH}/test-ansible-deps.txt" "${ARA_SRC_HOME}"
else
pip install --constraint "${COMMON_TESTS_PATH}/test-ansible-deps.txt" ara
fi
# Dynamically figure out the location of ARA (ex: py2 vs py3)
ara_location=$(python -c "import os,ara; print(os.path.dirname(ara.__file__))")
echo "Linking ${ANSIBLE_PLUGIN_DIR}/callback/ara to ${ara_location}/plugins/callbacks/"
mkdir -p "${ANSIBLE_PLUGIN_DIR}/callback/ara"
ln -sf "${ara_location}/plugins/callbacks" "${ANSIBLE_PLUGIN_DIR}/callback/ara/"
}
## Main ----------------------------------------------------------------------
# If the test reset toggle is set, destroy the existing cloned data.
@ -192,3 +214,5 @@ if [ ! -z "${ANSIBLE_EXTRA_ROLE_DIRS}" ]; then
sed -i "s|HOME/.ansible/roles.*|HOME/.ansible/roles:${ANSIBLE_ROLE_DIR}:${ANSIBLE_EXTRA_ROLE_DIRS}|" "${ANSIBLE_CFG_PATH}"
fi
fi
setup_ara

View File

@ -61,28 +61,6 @@ function set_ansible_parameters {
}
function setup_ara {
# Don't do anything if ARA has already been set up
[[ -L "${ANSIBLE_PLUGIN_DIR}/callback/ara" ]] && return 0
# Install ARA from source if running in ARA gate, otherwise install from PyPi
ARA_SRC_HOME="${TESTING_HOME}/src/git.openstack.org/openstack/ara"
if [[ -d "${ARA_SRC_HOME}" ]]; then
pip install --constraint "${COMMON_TESTS_PATH}/test-ansible-deps.txt" "${ARA_SRC_HOME}"
else
pip install --constraint "${COMMON_TESTS_PATH}/test-ansible-deps.txt" ara
fi
# Dynamically figure out the location of ARA (ex: py2 vs py3)
ara_location=$(python -c "import os,ara; print(os.path.dirname(ara.__file__))")
echo "Linking ${ANSIBLE_PLUGIN_DIR}/callback/ara to ${ara_location}/plugins/callbacks/"
mkdir -p "${ANSIBLE_PLUGIN_DIR}/callback/ara"
ln -sf "${ara_location}/plugins/callbacks" "${ANSIBLE_PLUGIN_DIR}/callback/ara/"
}
function execute_ansible_playbook {
CMD_TO_EXECUTE="ansible-playbook ${TEST_PLAYBOOK} $@ ${ANSIBLE_CLI_PARAMETERS}"
@ -109,7 +87,6 @@ fi
# Ensure that the Ansible environment is properly prepared
source "${COMMON_TESTS_PATH}/test-ansible-env-prep.sh"
setup_ara
# Prepare the extra CLI parameters used in each execution
set_ansible_parameters