Add pg_createcluster creating process for psql version after 9.3

postgresql 9.3 don't create /etc/postgresql and related conf file by
default. So we need start the pg_createcluster in devstack if has not
started after package installed.

Change-Id: I2b348658d79b23b5f21871b33d8023499b2fb956
Close-bug: #1552051
This commit is contained in:
Yalei Wang 2016-03-02 03:28:06 +00:00
parent 92116ecd66
commit 174986db21

View File

@ -47,7 +47,7 @@ function recreate_database_postgresql {
}
function configure_database_postgresql {
local pg_conf pg_dir pg_hba root_roles
local pg_conf pg_dir pg_hba root_roles version
echo_summary "Configuring and starting PostgreSQL"
if is_fedora; then
pg_hba=/var/lib/pgsql/data/pg_hba.conf
@ -56,6 +56,13 @@ function configure_database_postgresql {
sudo postgresql-setup initdb
fi
elif is_ubuntu; then
version=`psql --version | cut -d ' ' -f3 | cut -d. -f1-2`
if vercmp $version '>=' 9.3; then
if [ -z "`pg_lsclusters -h`" ]; then
echo 'No PostgreSQL clusters exist; will create one'
sudo pg_createcluster $version main --start
fi
fi
pg_dir=`find /etc/postgresql -name pg_hba.conf|xargs dirname`
pg_hba=$pg_dir/pg_hba.conf
pg_conf=$pg_dir/postgresql.conf