Skip to content

Commit

Permalink
Fix stacking without preconfigured DATABASE_PASSWORD
Browse files Browse the repository at this point in the history
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 <[email protected]>
Change-Id: I5ebf6b0280e82f2c87a63cbee7a9957c6bd26898
  • Loading branch information
osfrickler committed Dec 23, 2021
1 parent 24b65ad commit 353c3f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/database
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ function initialize_database_backends {
DATABASE_PASSWORD=$MYSQL_PASSWORD
fi

return 0
}

function define_database_baseurl {
# 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 and tables.
Expand All @@ -100,8 +104,6 @@ function initialize_database_backends {

# 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}

return 0
}

# Recreate a given database
Expand Down
2 changes: 2 additions & 0 deletions stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,8 @@ if initialize_database_backends; then
# Last chance for the database password. This must be handled here
# because read_password is not a library function.
read_password DATABASE_PASSWORD "ENTER A PASSWORD TO USE FOR THE DATABASE."

define_database_baseurl
else
echo "No database enabled"
fi
Expand Down

0 comments on commit 353c3f9

Please sign in to comment.