From d7a9d830ea164c0d6dc75a35ee14bb28e76ec8ef Mon Sep 17 00:00:00 2001 From: David Moreau-Simard Date: Fri, 21 Jul 2017 00:21:38 -0400 Subject: [PATCH] Dynamically retrieve the location of ARA to work on both py2 & py3 Remove the hardcoded callback path with python2.7 and use the virtualenv python to determine the path where ARA is installed so that no matter if we're running py2 or py3, it will work. Change-Id: Icc739743294d303d0a9e6e5a57b05f3e794e2215 --- scripts/gate-check-commit.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/gate-check-commit.sh b/scripts/gate-check-commit.sh index c069c7ec79..d86f53fecc 100755 --- a/scripts/gate-check-commit.sh +++ b/scripts/gate-check-commit.sh @@ -120,7 +120,10 @@ else # This installs from pypi /opt/ansible-runtime/bin/pip install ara fi -export ANSIBLE_CALLBACK_PLUGINS="/etc/ansible/roles/plugins/callback:/opt/ansible-runtime/lib/python2.7/site-packages/ara/plugins/callbacks" +# Dynamically retrieve the location of the ARA callback so we are able to find +# it on both py2 and py3 +ara_location=$(/opt/ansible-runtime/bin/python -c "import os,ara; print(os.path.dirname(ara.__file__))") +export ANSIBLE_CALLBACK_PLUGINS="/etc/ansible/roles/plugins/callback:${ara_location}/plugins/callbacks" # Log some data about the instance and the rest of the system log_instance_info