aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin André <m.andre@redhat.com>2015-09-15 09:01:20 +0900
committerMartin André <m.andre@redhat.com>2015-09-15 14:44:01 +0900
commit14acb298c2c778be058063842c5610dd4657c2c8 (patch)
treeffd3008e4a9270932278db102a40aa97e50827a2
parent13d4df321a96dbac64c18e8a8b3def7ab2d017c9 (diff)
downloadkolla-14acb298c2c778be058063842c5610dd4657c2c8.tar.gz
kolla-14acb298c2c778be058063842c5610dd4657c2c8.zip
Make kolla-ansible work in pip installed kolla
This is a quick hack to get kolla-ansible working with pip installed kolla, kolla-ansible will need to be rewritten at some point in python. Closes-Bug: #1495797 Change-Id: I7cf8c4baae76ff8f31514f64bed934848a1c3e40
-rwxr-xr-xtools/kolla-ansible18
1 files changed, 13 insertions, 5 deletions
diff --git a/tools/kolla-ansible b/tools/kolla-ansible
index abfe433fb..573158df0 100755
--- a/tools/kolla-ansible
+++ b/tools/kolla-ansible
@@ -2,9 +2,15 @@
#
# This script can be used to interact with kolla via ansible.
-# Move to top level directory
-REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')")
-cd "$(dirname "$REAL_PATH")/.."
+function find_base_dir {
+ local real_path=$(python -c "import os,sys;print os.path.realpath('$0')")
+ local dir_name="$(dirname "$real_path")"
+ if [[ ${dir_name} == "/usr/bin" ]]; then
+ BASEDIR=/usr/share/kolla
+ else
+ BASEDIR="${dir_name}/.."
+ fi
+}
function process_cmd {
echo "$ACTION : $CMD"
@@ -32,8 +38,10 @@ EOF
ARGS=$(getopt -o hi:p: -l help,inventory:,playbook: --name "$0" -- "$@") || { usage >&2; exit 2; }
eval set -- "$ARGS"
-INVENTORY="ansible/inventory/all-in-one"
-PLAYBOOK="ansible/site.yml"
+find_base_dir
+
+INVENTORY="${BASEDIR}/ansible/inventory/all-in-one"
+PLAYBOOK="${BASEDIR}/ansible/site.yml"
while [ "$#" -gt 0 ]; do
case "$1" in