Allow DATABASE_TYPE to be specified in localrc

The use of DATABASE_TYPE without forcing it into ENABLED_SERVICES
seems to be the only way to set up a multi-host devstack installation.

Only deprecate use_database.
Changes functionality of use_database to be equivalent to specifying DATABASE_TYPE
This means that people with localrc's that only specify use_database used to have
a database service brought up, but now will not until they add it to ENABLED_SERVICES.

Change-Id: I4c6e8ee31f298004338ca46bfc330a3e3af288aa
Fixes: bug 1136028
This commit is contained in:
Bob Ball 2013-02-28 17:39:41 +00:00
parent 493db1eb29
commit 3aa8887170
2 changed files with 1 additions and 14 deletions

View File

@ -1027,6 +1027,7 @@ function use_database {
# No backends registered means this is likely called from ``localrc`` # No backends registered means this is likely called from ``localrc``
# This is now deprecated usage # This is now deprecated usage
DATABASE_TYPE=$1 DATABASE_TYPE=$1
DEPRECATED_TEXT="$DEPRECATED_TEXT\nThe database backend needs to be properly set in ENABLED_SERVICES; use_database is deprecated localrc\n"
else else
# This should no longer get called...here for posterity # This should no longer get called...here for posterity
use_exclusive_service DATABASE_BACKENDS DATABASE_TYPE $1 use_exclusive_service DATABASE_BACKENDS DATABASE_TYPE $1

View File

@ -29,20 +29,6 @@ function register_database {
# Sourcing the database libs sets DATABASE_BACKENDS with the available list # Sourcing the database libs sets DATABASE_BACKENDS with the available list
for f in $TOP_DIR/lib/databases/*; do source $f; done for f in $TOP_DIR/lib/databases/*; do source $f; done
# If ``DATABASE_TYPE`` is defined here it's because the user has it in ``localrc``
# or has called ``use_database``. Both are deprecated so let's fix it up for now.
if [[ -n $DATABASE_TYPE ]]; then
# This is now deprecated usage, set up a warning and try to be
# somewhat backward compatible for now.
DEPRECATED_TEXT="$DEPRECATED_TEXT\nThe database backend needs to be properly set in ENABLED_SERVICES; DATABASE_TYPE or use_database is deprecated localrc\n"
if [[ ! $ENABLED_SERVICES =~ $DATABASE_TYPE ]]; then
# It's not in enabled services but user has attempted to select a
# database, so just add it now
ENABLED_SERVICES+=,$DATABASE_TYPE
unset DATABASE_TYPE
fi
fi
# ``DATABASE_BACKENDS`` now contains a list of the supported databases # ``DATABASE_BACKENDS`` now contains a list of the supported databases
# Look in ``ENABLED_SERVICES`` to see if one has been selected # Look in ``ENABLED_SERVICES`` to see if one has been selected
for db in $DATABASE_BACKENDS; do for db in $DATABASE_BACKENDS; do