Fix stacking without preconfigured DATABASE_PASSWORD

When we need to read a DATABASE_PASSWORD from the user, make sure we
actually use it in our database URLs.

Signed-off-by: Dr. Jens Harbott <harbott@osism.tech>
Change-Id: I5ebf6b0280e82f2c87a63cbee7a9957c6bd26898
This commit is contained in:
Dr. Jens Harbott 2021-12-23 12:01:44 +01:00
parent 24b65adc9c
commit 353c3f9cb1
No known key found for this signature in database
GPG Key ID: E7862B245C3596B1
2 changed files with 6 additions and 2 deletions

View File

@ -89,6 +89,10 @@ function initialize_database_backends {
DATABASE_PASSWORD=$MYSQL_PASSWORD DATABASE_PASSWORD=$MYSQL_PASSWORD
fi fi
return 0
}
function define_database_baseurl {
# We configure Nova, Horizon, Glance and Keystone to use MySQL as their # We configure Nova, Horizon, Glance and Keystone to use MySQL as their
# database server. While they share a single server, each has their own # database server. While they share a single server, each has their own
# database and tables. # database and tables.
@ -100,8 +104,6 @@ function initialize_database_backends {
# NOTE: Don't specify ``/db`` in this string so we can use it for multiple services # NOTE: Don't specify ``/db`` in this string so we can use it for multiple services
BASE_SQL_CONN=${BASE_SQL_CONN:-$(get_database_type_$DATABASE_TYPE)://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOST} BASE_SQL_CONN=${BASE_SQL_CONN:-$(get_database_type_$DATABASE_TYPE)://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOST}
return 0
} }
# Recreate a given database # Recreate a given database

View File

@ -691,6 +691,8 @@ if initialize_database_backends; then
# Last chance for the database password. This must be handled here # Last chance for the database password. This must be handled here
# because read_password is not a library function. # because read_password is not a library function.
read_password DATABASE_PASSWORD "ENTER A PASSWORD TO USE FOR THE DATABASE." read_password DATABASE_PASSWORD "ENTER A PASSWORD TO USE FOR THE DATABASE."
define_database_baseurl
else else
echo "No database enabled" echo "No database enabled"
fi fi