From 4196d5565e48608c64fccdd9e17fcc01dd8d06fe Mon Sep 17 00:00:00 2001 From: Jakub Ruzicka Date: Wed, 30 Jan 2013 15:35:54 +0100 Subject: [PATCH] Introduce get_python_exec_prefix function. get_python_exec_prefix returns the path to the direcotry where python executables are installed, that is /usr/bin on Fedora and /usr/local/bin everywhere else. It is used to properly locate OpenStack executables. Fixes: bug #1068386 Change-Id: I228498ebe2762568d00757d065e37377ee2c8fb3 --- functions | 16 +++++++++++----- lib/ceilometer | 2 +- lib/cinder | 2 +- lib/glance | 2 +- lib/nova | 2 +- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/functions b/functions index 79483785b6..68aec5d2f5 100644 --- a/functions +++ b/functions @@ -1110,17 +1110,23 @@ function add_user_to_group() { } +# Get the path to the direcotry where python executables are installed. +# get_python_exec_prefix +function get_python_exec_prefix() { + if is_fedora; then + echo "/usr/bin" + else + echo "/usr/local/bin" + fi +} + # Get the location of the $module-rootwrap executables, where module is cinder # or nova. # get_rootwrap_location module function get_rootwrap_location() { local module=$1 - if is_fedora; then - echo "/usr/bin/$module-rootwrap" - else - echo "/usr/local/bin/$module-rootwrap" - fi + echo "$(get_python_exec_prefix)/$module-rootwrap" } # Get the path to the pip command. diff --git a/lib/ceilometer b/lib/ceilometer index 0fae397355..41a5f53d9f 100644 --- a/lib/ceilometer +++ b/lib/ceilometer @@ -40,7 +40,7 @@ CEILOMETER_AUTH_CACHE_DIR=${CEILOMETER_AUTH_CACHE_DIR:-/var/cache/ceilometer} if [ -d $CEILOMETER_DIR/bin ] ; then CEILOMETER_BIN_DIR=$CEILOMETER_DIR/bin else - CEILOMETER_BIN_DIR=/usr/local/bin + CEILOMETER_BIN_DIR=$(get_python_exec_prefix) fi # cleanup_ceilometer() - Remove residual data files, anything left over from previous diff --git a/lib/cinder b/lib/cinder index 5f4f979b22..28b3caa52c 100644 --- a/lib/cinder +++ b/lib/cinder @@ -47,7 +47,7 @@ CINDER_SERVICE_PROTOCOL=${CINDER_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL} if [[ -d $CINDER_DIR/bin ]]; then CINDER_BIN_DIR=$CINDER_DIR/bin else - CINDER_BIN_DIR=/usr/local/bin + CINDER_BIN_DIR=$(get_python_exec_prefix) fi # Name of the lvm volume group to use/create for iscsi volumes diff --git a/lib/glance b/lib/glance index 1c56a67553..5d48129d78 100644 --- a/lib/glance +++ b/lib/glance @@ -44,7 +44,7 @@ GLANCE_POLICY_JSON=$GLANCE_CONF_DIR/policy.json if [[ -d $GLANCE_DIR/bin ]]; then GLANCE_BIN_DIR=$GLANCE_DIR/bin else - GLANCE_BIN_DIR=/usr/local/bin + GLANCE_BIN_DIR=$(get_python_exec_prefix) fi # Glance connection info. Note the port must be specified. diff --git a/lib/nova b/lib/nova index 7e5bb9967f..41162781e7 100644 --- a/lib/nova +++ b/lib/nova @@ -49,7 +49,7 @@ NOVA_SERVICE_PROTOCOL=${NOVA_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL} if [[ -d $NOVA_DIR/bin ]]; then NOVA_BIN_DIR=$NOVA_DIR/bin else - NOVA_BIN_DIR=/usr/local/bin + NOVA_BIN_DIR=$(get_python_exec_prefix) fi # Set the paths of certain binaries