Add python_version function to functions-common

This makes it possible to list virtual site-package directories
without statically stating the python version, which is a bit ugly.

Change-Id: I3e7ac39eb43cdc4f656e0c90f3bfb23545722aef
This commit is contained in:
Chris Dent 2015-05-12 13:41:25 +00:00
parent d5bcc42a71
commit 3a2c86aabf
3 changed files with 8 additions and 2 deletions

View File

@ -1897,6 +1897,12 @@ function maskip {
echo $subnet
}
# Return the current python as "python<major>.<minor>"
function python_version {
local python_version=$(python -c 'import sys; print("%s.%s" % sys.version_info[0:2])')
echo "python${python_version}"
}
# Service wrapper to restart services
# restart_service service-name
function restart_service {

View File

@ -164,7 +164,7 @@ function _config_keystone_apache_wsgi {
keystone_auth_port=$KEYSTONE_AUTH_PORT_INT
fi
if [[ ${USE_VENV} = True ]]; then
venv_path="python-path=${PROJECT_VENV["keystone"]}/lib/python2.7/site-packages"
venv_path="python-path=${PROJECT_VENV["keystone"]}/lib/$(python_version)/site-packages"
fi
# copy proxy vhost and wsgi file

View File

@ -259,7 +259,7 @@ function _config_nova_apache_wsgi {
nova_keyfile="SSLCertificateKeyFile $NOVA_SSL_KEY"
fi
if [[ ${USE_VENV} = True ]]; then
venv_path="python-path=${PROJECT_VENV["nova"]}/lib/python2.7/site-packages"
venv_path="python-path=${PROJECT_VENV["nova"]}/lib/$(python_version)/site-packages"
fi
# copy proxy vhost and wsgi helper files