From 6b127cb2bcea5389528558b6a3f2a4a987c5f7e1 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Wed, 24 Jan 2018 11:37:09 +0000 Subject: [PATCH] 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 --- test-ansible-env-prep.sh | 24 ++++++++++++++++++++++++ test-ansible-functional.sh | 23 ----------------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/test-ansible-env-prep.sh b/test-ansible-env-prep.sh index 8ad9bcbd..2497cbc3 100755 --- a/test-ansible-env-prep.sh +++ b/test-ansible-env-prep.sh @@ -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 diff --git a/test-ansible-functional.sh b/test-ansible-functional.sh index eb51b994..8b82059a 100755 --- a/test-ansible-functional.sh +++ b/test-ansible-functional.sh @@ -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