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
This commit is contained in:
David Moreau-Simard 2017-07-21 00:21:38 -04:00
parent 8432db53de
commit d7a9d830ea

View File

@ -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