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
This commit is contained in:
Martin André 2015-09-15 09:01:20 +09:00
parent 13d4df321a
commit 14acb298c2

View File

@ -2,9 +2,15 @@
# #
# This script can be used to interact with kolla via ansible. # This script can be used to interact with kolla via ansible.
# Move to top level directory function find_base_dir {
REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')") local real_path=$(python -c "import os,sys;print os.path.realpath('$0')")
cd "$(dirname "$REAL_PATH")/.." local dir_name="$(dirname "$real_path")"
if [[ ${dir_name} == "/usr/bin" ]]; then
BASEDIR=/usr/share/kolla
else
BASEDIR="${dir_name}/.."
fi
}
function process_cmd { function process_cmd {
echo "$ACTION : $CMD" echo "$ACTION : $CMD"
@ -32,8 +38,10 @@ EOF
ARGS=$(getopt -o hi:p: -l help,inventory:,playbook: --name "$0" -- "$@") || { usage >&2; exit 2; } ARGS=$(getopt -o hi:p: -l help,inventory:,playbook: --name "$0" -- "$@") || { usage >&2; exit 2; }
eval set -- "$ARGS" eval set -- "$ARGS"
INVENTORY="ansible/inventory/all-in-one" find_base_dir
PLAYBOOK="ansible/site.yml"
INVENTORY="${BASEDIR}/ansible/inventory/all-in-one"
PLAYBOOK="${BASEDIR}/ansible/site.yml"
while [ "$#" -gt 0 ]; do while [ "$#" -gt 0 ]; do
case "$1" in case "$1" in