Merge "Add global venv enable/disable knob"

This commit is contained in:
Jenkins 2015-03-26 20:32:31 +00:00 committed by Gerrit Code Review
commit c392fd3b5f
8 changed files with 55 additions and 3 deletions

View File

@ -170,6 +170,30 @@ Libraries from Git
LIBS_FROM_GIT=python-keystoneclient,oslo.config LIBS_FROM_GIT=python-keystoneclient,oslo.config
Virtual Environments
--------------------
| *Default: ``USE_VENV=False``*
| Enable the use of Python virtual environments by setting ``USE_VENV``
to ``True``. This will enable the creation of venvs for each project
that is defined in the ``PROJECT_VENV`` array.
| *Default: ``PROJECT_VENV['<project>']='<project-dir>.venv'*
| Each entry in the ``PROJECT_VENV`` array contains the directory name
of a venv to be used for the project. The array index is the project
name. Multiple projects can use the same venv if desired.
::
PROJECT_VENV["glance"]=${GLANCE_DIR}.venv
| *Default: ``ADDITIONAL_VENV_PACKAGES=""``*
| A comma-separated list of additional packages to be installed into each
venv. Often projects will not have certain packages listed in its
``requirements.txt`` file because they are 'optional' requirements,
i.e. only needed for certain configurations. By default, the enabled
databases will have their Python bindings added when they are enabled.
Enable Logging Enable Logging
-------------- --------------

View File

@ -211,6 +211,8 @@ Tools
----- -----
* `tools/build\_docs.sh <tools/build_docs.sh.html>`__ * `tools/build\_docs.sh <tools/build_docs.sh.html>`__
* `tools/build\_venv.sh <tools/build_venv.sh.html>`__
* `tools/build\_wheels.sh <tools/build_wheels.sh.html>`__
* `tools/create-stack-user.sh <tools/create-stack-user.sh.html>`__ * `tools/create-stack-user.sh <tools/create-stack-user.sh.html>`__
* `tools/create\_userrc.sh <tools/create_userrc.sh.html>`__ * `tools/create\_userrc.sh <tools/create_userrc.sh.html>`__
* `tools/fixup\_stuff.sh <tools/fixup_stuff.sh.html>`__ * `tools/fixup\_stuff.sh <tools/fixup_stuff.sh.html>`__

View File

@ -109,6 +109,11 @@ function install_database {
install_database_$DATABASE_TYPE install_database_$DATABASE_TYPE
} }
# Install the database Python packages
function install_database_python {
install_database_python_$DATABASE_TYPE
}
# Configure and start the database # Configure and start the database
function configure_database { function configure_database {
configure_database_$DATABASE_TYPE configure_database_$DATABASE_TYPE

View File

@ -151,9 +151,12 @@ EOF
else else
exit_distro_not_supported "mysql installation" exit_distro_not_supported "mysql installation"
fi fi
}
function install_database_python_mysql {
# Install Python client module # Install Python client module
pip_install MySQL-python pip_install MySQL-python
ADDITIONAL_VENV_PACKAGES+=",MySQL-python"
} }
function database_connection_url_mysql { function database_connection_url_mysql {

View File

@ -100,9 +100,12 @@ EOF
else else
exit_distro_not_supported "postgresql installation" exit_distro_not_supported "postgresql installation"
fi fi
}
function install_database_python_postgresql {
# Install Python client module # Install Python client module
pip_install psycopg2 pip_install psycopg2
ADDITIONAL_VENV_PACKAGES+=",psycopg2"
} }
function database_connection_url_postgresql { function database_connection_url_postgresql {

View File

@ -16,13 +16,17 @@
function stack_install_service { function stack_install_service {
local service=$1 local service=$1
if type install_${service} >/dev/null 2>&1; then if type install_${service} >/dev/null 2>&1; then
if [[ -n ${PROJECT_VENV[$service]:-} ]]; then if [[ ${USE_VENV} = True && -n ${PROJECT_VENV[$service]:-} ]]; then
rm -rf ${PROJECT_VENV[$service]} rm -rf ${PROJECT_VENV[$service]}
source $TOP_DIR/tools/build_venv.sh ${PROJECT_VENV[$service]} source $TOP_DIR/tools/build_venv.sh ${PROJECT_VENV[$service]} ${ADDITIONAL_VENV_PACKAGES//,/ }
export PIP_VIRTUAL_ENV=${PROJECT_VENV[$service]:-} export PIP_VIRTUAL_ENV=${PROJECT_VENV[$service]:-}
# Install other OpenStack prereqs that might come from source repos
install_oslo
install_keystonemiddleware
fi fi
install_${service} install_${service}
if [[ -n ${PROJECT_VENV[$service]:-} ]]; then if [[ ${USE_VENV} = True && -n ${PROJECT_VENV[$service]:-} ]]; then
unset PIP_VIRTUAL_ENV unset PIP_VIRTUAL_ENV
fi fi
fi fi

View File

@ -713,6 +713,7 @@ install_rpc_backend
if is_service_enabled $DATABASE_BACKENDS; then if is_service_enabled $DATABASE_BACKENDS; then
install_database install_database
install_database_python
fi fi
if is_service_enabled neutron; then if is_service_enabled neutron; then

10
stackrc
View File

@ -104,6 +104,16 @@ elif [[ -f $RC_DIR/.localrc.auto ]]; then
source $RC_DIR/.localrc.auto source $RC_DIR/.localrc.auto
fi fi
# Enable use of Python virtual environments. Individual project use of
# venvs are controlled by the PROJECT_VENV array; every project with
# an entry in the array will be installed into the named venv.
# By default this will put each project into its own venv.
USE_VENV=$(trueorfalse False USE_VENV)
# Add packages that need to be installed into a venv but are not in any
# requirmenets files here, in a comma-separated list
ADDITIONAL_VENV_PACKAGES=${ADITIONAL_VENV_PACKAGES:-""}
# Configure wheel cache location # Configure wheel cache location
export WHEELHOUSE=${WHEELHOUSE:-$DEST/.wheelhouse} export WHEELHOUSE=${WHEELHOUSE:-$DEST/.wheelhouse}
export PIP_WHEEL_DIR=${PIP_WHEEL_DIR:-$WHEELHOUSE} export PIP_WHEEL_DIR=${PIP_WHEEL_DIR:-$WHEELHOUSE}