From 9938ef14ebb655a2b4001cc6fcbe334df5aa35fa Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Mon, 2 Apr 2018 11:00:51 -0500 Subject: [PATCH] Resolve common roles required for test This change adds a common test role requirements file to the preparation process whch will ensure all required common roles are available prior to running tests. As we move to use common roles throughout our deliverables this change will help ensure we're not having to map complex common dependencies throughout our supported roles, which is prone to human error and can cause cascading failures throughout out stack should a requirement be missed. Change-Id: If3c57d5c864aee3a6bc461dead367eac7f3eede2 Signed-off-by: Kevin Carter --- test-ansible-env-prep.sh | 23 +++++++++++++++-------- test-ansible-role-requirements.yml | 17 +++++++++++++++++ 2 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 test-ansible-role-requirements.yml diff --git a/test-ansible-env-prep.sh b/test-ansible-env-prep.sh index 0dff00f7..a1ebb57b 100755 --- a/test-ansible-env-prep.sh +++ b/test-ansible-env-prep.sh @@ -176,15 +176,22 @@ fi # Download the Ansible role repositories if they are not present on the host. # This is ignored if there is no ansible-role-requirements file. -if [ ! -d "${ANSIBLE_ROLE_DEP_DIR}" ] && [ -f "${ANSIBLE_ROLE_REQUIREMENTS_PATH}" ]; then - ansible-playbook -i ${ANSIBLE_INVENTORY} \ - ${COMMON_TESTS_PATH}/get-ansible-role-requirements.yml \ - -v - if [[ ! -e "${ANSIBLE_ROLE_DEP_DIR}/plugins" ]]; then - ln -s "${ANSIBLE_PLUGIN_DIR}" "${ANSIBLE_ROLE_DEP_DIR}/plugins" - fi -fi +if [[ ! -d "${ANSIBLE_ROLE_DEP_DIR}" ]]; then + # Download the common test Ansible role repositories. + ANSIBLE_ROLE_REQUIREMENTS_PATH=${COMMON_TESTS_PATH}/test-ansible-role-requirements.yml \ + ansible-playbook -i ${ANSIBLE_INVENTORY} \ + ${COMMON_TESTS_PATH}/get-ansible-role-requirements.yml \ + -v + if [[ -f "${ANSIBLE_ROLE_REQUIREMENTS_PATH}" ]]; then + ansible-playbook -i ${ANSIBLE_INVENTORY} \ + ${COMMON_TESTS_PATH}/get-ansible-role-requirements.yml \ + -v + if [[ ! -e "${ANSIBLE_ROLE_DEP_DIR}/plugins" ]]; then + ln -s "${ANSIBLE_PLUGIN_DIR}" "${ANSIBLE_ROLE_DEP_DIR}/plugins" + fi + fi +fi # If a role name is provided, replace the role in the roles folder with a link # to the current folder. This ensures that the test executes with the checked diff --git a/test-ansible-role-requirements.yml b/test-ansible-role-requirements.yml new file mode 100644 index 00000000..adbfb12a --- /dev/null +++ b/test-ansible-role-requirements.yml @@ -0,0 +1,17 @@ +--- +- name: systemd_service + src: https://git.openstack.org/openstack/ansible-role-systemd_service + scm: git + version: master +- name: systemd_mount + src: https://git.openstack.org/openstack/ansible-role-systemd_mount + scm: git + version: master +- name: systemd_networkd + src: https://git.openstack.org/openstack/ansible-role-systemd_networkd + scm: git + version: master +- name: python_venv_build + src: https://git.openstack.org/openstack/ansible-role-python_venv_build + scm: git + version: master