From 77f1812e002e47314de4c7b70714d6d36907a05b Mon Sep 17 00:00:00 2001
From: David Moreau-Simard <dms@redhat.com>
Date: Sat, 22 Jul 2017 21:45:43 -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: Ica0b94aeebabaeca8416a9768fadd12d3925e7b2
---
 tools/setup_gate.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/setup_gate.sh b/tools/setup_gate.sh
index 0da013343d..f0758fab0a 100755
--- a/tools/setup_gate.sh
+++ b/tools/setup_gate.sh
@@ -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