Browse code

Merge "Add python_version function to functions-common"

Jenkins authored on 2015/05/13 20:41:06
Showing 3 changed files
... ...
@@ -1899,6 +1899,12 @@ function maskip {
1899 1899
     echo $subnet
1900 1900
 }
1901 1901
 
1902
+# Return the current python as "python<major>.<minor>"
1903
+function python_version {
1904
+    local python_version=$(python -c 'import sys; print("%s.%s" % sys.version_info[0:2])')
1905
+    echo "python${python_version}"
1906
+}
1907
+
1902 1908
 # Service wrapper to restart services
1903 1909
 # restart_service service-name
1904 1910
 function restart_service {
... ...
@@ -164,7 +164,7 @@ function _config_keystone_apache_wsgi {
164 164
         keystone_auth_port=$KEYSTONE_AUTH_PORT_INT
165 165
     fi
166 166
     if [[ ${USE_VENV} = True ]]; then
167
-        venv_path="python-path=${PROJECT_VENV["keystone"]}/lib/python2.7/site-packages"
167
+        venv_path="python-path=${PROJECT_VENV["keystone"]}/lib/$(python_version)/site-packages"
168 168
     fi
169 169
 
170 170
     # copy proxy vhost and wsgi file
... ...
@@ -259,7 +259,7 @@ function _config_nova_apache_wsgi {
259 259
         nova_keyfile="SSLCertificateKeyFile $NOVA_SSL_KEY"
260 260
     fi
261 261
     if [[ ${USE_VENV} = True ]]; then
262
-        venv_path="python-path=${PROJECT_VENV["nova"]}/lib/python2.7/site-packages"
262
+        venv_path="python-path=${PROJECT_VENV["nova"]}/lib/$(python_version)/site-packages"
263 263
     fi
264 264
 
265 265
     # copy proxy vhost and wsgi helper files