Add PostgreSQL support to devstack
This patch adds an interface for supporting multiple database backend
types and implemnts support for PostgreSQL. It also adds a function,
use_exclusive_service, which serves as a base for enabling a service
that conflicts with other services. The use_database function uses it,
and it might also be useful for selecting messaging backends.
MySQL is still selected by default. Tested on Fedora 17 and Ubuntu
12.04 with MySQL and PostgreSQL. Implements blueprint postgresql-support
Change-Id: I4b1373e25676fd9a9809fe70cb4a6450a2479174
diff --git a/functions b/functions
index dbe9d30..917727d 100644
--- a/functions
+++ b/functions
@@ -836,6 +836,21 @@
fi
}
+# Toggle enable/disable_service for services that must run exclusive of each other
+# $1 The name of a variable containing a space-separated list of services
+# $2 The name of a variable in which to store the enabled service's name
+# $3 The name of the service to enable
+function use_exclusive_service {
+ local options=${!1}
+ local selection=$3
+ out=$2
+ [ -z $selection ] || [[ ! "$options" =~ "$selection" ]] && return 1
+ for opt in $options;do
+ [[ "$opt" = "$selection" ]] && enable_service $opt || disable_service $opt
+ done
+ eval "$out=$selection"
+ return 0
+}
# Wrapper for ``yum`` to set proxy environment variables
# Uses globals ``OFFLINE``, ``*_proxy`