aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-09-15 12:17:34 +0000
committerGerrit Code Review <review@openstack.org>2015-09-15 12:17:34 +0000
commit4bf3b3615221c0610b4c7f21a0138228ebd063d8 (patch)
tree203ed8f64a277d789a4178e8de851bd561b6c410
parent172103749ea8313631f29cd816a531d4e4c275d0 (diff)
parent14acb298c2c778be058063842c5610dd4657c2c8 (diff)
downloadkolla-4bf3b3615221c0610b4c7f21a0138228ebd063d8.tar.gz
kolla-4bf3b3615221c0610b4c7f21a0138228ebd063d8.zip
Merge "Make kolla-ansible work in pip installed kolla"
-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