Skip to content

Commit

Permalink
Resolve common roles required for test
Browse files Browse the repository at this point in the history
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 <kevin.carter@rackspace.com>
  • Loading branch information
cloudnull committed Apr 6, 2018
1 parent 748e3d2 commit 9938ef1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
23 changes: 15 additions & 8 deletions test-ansible-env-prep.sh
Expand Up @@ -176,16 +176,23 @@ 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
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
# out git repo.
Expand Down
17 changes: 17 additions & 0 deletions 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

0 comments on commit 9938ef1

Please sign in to comment.