Simplify database selection

Do not require every script that sources stackrc to also
source lib/databases.

* Move use_databases() to functions
* Set DATABASE_TYPE in stackrc
* Allow setting DATABASE_TYPE in localrc to work
  (use_database() essentially just sets DATABASE_TYPE at this stage
  so continuing to use it is equivalent)
* Validate DATABASE_TYPE in stack.sh.
* Change sudo to postgresql user to go through root to eliminate
  password prompt
* fix use_database error condition

Change-Id: Ibb080c76e6cd7c6eebbb641a894d54b1dde78ca6
This commit is contained in:
Dean Troyer
2012-11-05 14:26:09 -06:00
committed by Sean Dague
parent 8205e0dcfb
commit c1b486a520
5 changed files with 30 additions and 14 deletions
-9
View File
@@ -62,15 +62,6 @@ function initialize_database_backends {
return 0
}
# Set the database backend to use
# $1 The name of the database backend to use (mysql, postgresql, ...)
function use_database {
use_exclusive_service DATABASE_BACKENDS DATABASE_TYPE $1 && return 0
ret=$?
echo "Invalid database '$1'"
return $ret
}
# Recreate a given database
# $1 The name of the database
# $2 The character set/encoding of the database