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: Ica0b94aeebabaeca8416a9768fadd12d3925e7b2
This commit is contained in:
David Moreau-Simard 2017-07-22 21:45:43 -04:00
parent 23ac09c955
commit 77f1812e00

View File

@ -132,9 +132,10 @@ function setup_ansible {
setup_inventory
sudo mkdir /etc/ansible
ara_location=$(python -c "import os,ara; print(os.path.dirname(ara.__file__))")
sudo tee /etc/ansible/ansible.cfg<<EOF
[defaults]
callback_plugins = /usr/lib/python2.7/site-packages/ara/plugins/callbacks:\$VIRTUAL_ENV/lib/python2.7/site-packages/ara/plugins/callbacks
callback_plugins = ${ara_location}/plugins/callbacks
host_key_checking = False
EOF