Browse code

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

Bob Ball authored on 2013/03/01 02:39:41
Showing 2 changed files
... ...
@@ -1027,6 +1027,7 @@ function use_database {
1027 1027
         # No backends registered means this is likely called from ``localrc``
1028 1028
         # This is now deprecated usage
1029 1029
         DATABASE_TYPE=$1
1030
+        DEPRECATED_TEXT="$DEPRECATED_TEXT\nThe database backend needs to be properly set in ENABLED_SERVICES; use_database is deprecated localrc\n"
1030 1031
     else
1031 1032
         # This should no longer get called...here for posterity
1032 1033
         use_exclusive_service DATABASE_BACKENDS DATABASE_TYPE $1
... ...
@@ -29,20 +29,6 @@ function register_database {
29 29
 # Sourcing the database libs sets DATABASE_BACKENDS with the available list
30 30
 for f in $TOP_DIR/lib/databases/*; do source $f; done
31 31
 
32
-# If ``DATABASE_TYPE`` is defined here it's because the user has it in ``localrc``
33
-# or has called ``use_database``.  Both are deprecated so let's fix it up for now.
34
-if [[ -n $DATABASE_TYPE ]]; then
35
-    # This is now deprecated usage, set up a warning and try to be
36
-    # somewhat backward compatible for now.
37
-    DEPRECATED_TEXT="$DEPRECATED_TEXT\nThe database backend needs to be properly set in ENABLED_SERVICES; DATABASE_TYPE or use_database is deprecated localrc\n"
38
-    if [[ ! $ENABLED_SERVICES =~ $DATABASE_TYPE ]]; then
39
-        # It's not in enabled services but user has attempted to select a
40
-        # database, so just add it now
41
-        ENABLED_SERVICES+=,$DATABASE_TYPE
42
-        unset DATABASE_TYPE
43
-    fi
44
-fi
45
-
46 32
 # ``DATABASE_BACKENDS`` now contains a list of the supported databases
47 33
 # Look in ``ENABLED_SERVICES`` to see if one has been selected
48 34
 for db in $DATABASE_BACKENDS; do