tests: test-galera-upgrades.sh: Workaround Ansible 2.4+ precedence bug

Ansible 2.4+ suffers from a precedence bug when including tasks in
roles. It appears that a file in a relative tasks/ path inside the
current working directory is preferred over an identical file
from the role itself. For example:

task path: /home/zuul/.ansible/roles/previous_galera_server/tasks/galera_install.yml:20
included: /home/zuul/src/git.openstack.org/openstack/openstack-ansible-galera_server/tasks/galera_install_apt.yml for container1

As one can see, instead of including the galera_install_apt.yml from the
/home/zuul/.ansible/roles/previous_galera_server/tasks/ directory, the
one which is relative to the current working directory
(/home/zuul/src/git.openstack.org/openstack/openstack-ansible-galera_server/)
is preferred. We can simply workaround that by entering a different
directory which doesn't look like a role directory structure before executing
that part of the upgrade job.

Change-Id: If208e72d66ed441e8fcdee4882637301527cb231
Link: https://github.com/ansible/ansible/pull/34790
This commit is contained in:
Markos Chandras 2018-02-15 13:00:02 +00:00
parent 873cdf1e8c
commit 4575f149d6

View File

@ -77,6 +77,13 @@ execute_ansible_playbook
# Create an ansible venv matching previous branch
source ${WORKING_DIR}/tests/common/test-create-previous-venv.sh
# NOTE(hwoarang): Ansible 2.4+ is broken in terms of task inclusion and relative
# files are preferred over those belonging to the actual role. As such, we need to
# change the current directory to something that doesn't look like a role directory
# structure when executing the previous role
# https://github.com/ansible/ansible/pull/34790
cd ${WORKING_DIR}/tests
# Prepare environment for the deploy of previous Galera:
# No upgrading or testing is done yet.
export TEST_PLAYBOOK="${WORKING_DIR}/tests/test-install-previous-galera.yml"
@ -90,6 +97,8 @@ execute_ansible_playbook
unset PREVIOUS_VENV
unset ANSIBLE_BIN
cd -
# Prepare environment for the upgrade
export TEST_PLAYBOOK="${WORKING_DIR}/tests/test-upgrade-post.yml"
export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_DIR}/ansible-execute-upgrade.log"