From 29771c1c1e09e6bf2cad0f67cf4c176735f5ac0a Mon Sep 17 00:00:00 2001 From: Luigi Toscano Date: Thu, 21 Feb 2019 10:36:18 +0100 Subject: [PATCH] Remove the usage of read_password from library files The read_password function is defined inside stack.sh and it cannot be used inside the "public library interface" provided by DevStack. Move the calls found inside library files to stack.sh, following the same pattern of the other calls to read_password. Change-Id: I8adc6723b677dfac2bef735f660e056c498bf773 --- lib/database | 2 -- lib/nova_plugins/hypervisor-xenserver | 1 - stack.sh | 19 ++++++++++++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/database b/lib/database index 0d720527df..7940cf2208 100644 --- a/lib/database +++ b/lib/database @@ -87,8 +87,6 @@ function initialize_database_backends { if [ -n "$MYSQL_PASSWORD" ]; then DATABASE_PASSWORD=$MYSQL_PASSWORD - else - read_password DATABASE_PASSWORD "ENTER A PASSWORD TO USE FOR THE DATABASE." fi # We configure Nova, Horizon, Glance and Keystone to use MySQL as their diff --git a/lib/nova_plugins/hypervisor-xenserver b/lib/nova_plugins/hypervisor-xenserver index 6f79e4ff7c..cd4d3caa84 100644 --- a/lib/nova_plugins/hypervisor-xenserver +++ b/lib/nova_plugins/hypervisor-xenserver @@ -59,7 +59,6 @@ function configure_nova_hypervisor { die $LINENO "os-xenapi plugin is not specified. Please enable this plugin in local.conf" fi - read_password XENAPI_PASSWORD "ENTER A PASSWORD TO USE FOR XEN." iniset $NOVA_CONF DEFAULT compute_driver "xenapi.XenAPIDriver" iniset $NOVA_CONF xenserver connection_url "$XENAPI_CONNECTION_URL" iniset $NOVA_CONF xenserver connection_username "$XENAPI_USER" diff --git a/stack.sh b/stack.sh index 022d5b9438..8d4042dc23 100755 --- a/stack.sh +++ b/stack.sh @@ -691,7 +691,14 @@ function read_password { # The available database backends are listed in ``DATABASE_BACKENDS`` after # ``lib/database`` is sourced. ``mysql`` is the default. -initialize_database_backends && echo "Using $DATABASE_TYPE database backend" || echo "No database enabled" +if initialize_database_backends; then + echo "Using $DATABASE_TYPE database backend" + # 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." +else + echo "No database enabled" +fi # Queue Configuration @@ -729,6 +736,16 @@ if is_service_enabled keystone; then fi +# Nova +# ----- + +if is_service_enabled nova && [[ "$VIRT_DRIVER" == 'xenserver' ]]; then + # Look for the backend password here because read_password + # is not a library function. + read_password XENAPI_PASSWORD "ENTER A PASSWORD TO USE FOR XEN." +fi + + # Swift # -----