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
diff --git a/functions b/functions
index 11f7d50..9a59616 100644
--- a/functions
+++ b/functions
@@ -1027,6 +1027,7 @@
# No backends registered means this is likely called from ``localrc``
# This is now deprecated usage
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
# This should no longer get called...here for posterity
use_exclusive_service DATABASE_BACKENDS DATABASE_TYPE $1
diff --git a/lib/database b/lib/database
index 4fba7c2..ebab333 100644
--- a/lib/database
+++ b/lib/database
@@ -29,20 +29,6 @@
# Sourcing the database libs sets DATABASE_BACKENDS with the available list
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
# Look in ``ENABLED_SERVICES`` to see if one has been selected
for db in $DATABASE_BACKENDS; do