Use database password from variable
There is a variable that tells what is the database (mysql) password. However plugin.sh is using a hardcoded password. Commit provides using DATABASE_PASSWORD in a way similar to DEVSTACK. Additionally substituted hardcoded database user and host with variables: * DATABASE_USER * MYSQL_HOST Change-Id: I7967c42b78037d922c6dd7a638a6232266313d83
This commit is contained in:
parent
968f41fa86
commit
0d8e0c8a2e
|
@ -21,7 +21,6 @@ To run Monasca in DevStack, do the following three steps.
|
|||
\# BEGIN DEVSTACK LOCAL.CONF CONTENTS
|
||||
|
||||
[[local|localrc]]
|
||||
MYSQL_PASSWORD=secretmysql
|
||||
DATABASE_PASSWORD=secretdatabase
|
||||
RABBIT_PASSWORD=secretrabbit
|
||||
ADMIN_PASSWORD=secretadmin
|
||||
|
@ -86,7 +85,7 @@ To enable Vertica, do the following:
|
|||
1. Register and download the Vertica Debian installer from `https://my.vertica.com/download/vertica/community-edition/` and put it in your home directory.
|
||||
Unfortunately, there isn't a URL that the DevStack installer can automatically use, so it must be downloaded seperately, and put in a location where the installer can find it when it runs.
|
||||
The installer assumes this location is your home directory.
|
||||
When using Vagrant, your home directory will normally be mounted inside the VM as "/vagrant_home".
|
||||
When using Vagrant, your home directory will normally be mounted inside the VM as "/vagrant_home".
|
||||
|
||||
2. Modify the environment variable `MONASCA_METRICS_DB` in the `local.conf`, `settings` or `Vagrantfile` file from influxdb to vertica as follows:
|
||||
|
||||
|
|
|
@ -80,7 +80,6 @@ SERVICE_HOST=192.168.10.6
|
|||
HOST_IP=192.168.10.6
|
||||
HOST_IP_IFACE=eth1
|
||||
MYSQL_HOST=192.168.10.6
|
||||
MYSQL_PASSWORD=secretmysql
|
||||
DATABASE_PASSWORD=secretdatabase
|
||||
RABBIT_PASSWORD=secretrabbit
|
||||
ADMIN_PASSWORD=secretadmin
|
||||
|
|
|
@ -51,6 +51,11 @@ export MONASCA_PERSISTER_IMPLEMENTATION_LANG=${MONASCA_PERSISTER_IMPLEMENTATION_
|
|||
# Set default metrics DB to InfluxDB
|
||||
export MONASCA_METRICS_DB=${MONASCA_METRICS_DB:-influxdb}
|
||||
|
||||
# Determine password for database (copied from devstack/lib/database)
|
||||
if [ -n "$MYSQL_PASSWORD" ]; then
|
||||
DATABASE_PASSWORD=$MYSQL_PASSWORD
|
||||
fi
|
||||
|
||||
# Determine if we are running in devstack-gate or devstack.
|
||||
if [[ $DEST ]]; then
|
||||
|
||||
|
@ -740,7 +745,7 @@ function install_schema {
|
|||
sudo chown root:root /opt/monasca/sqls/mon.sql
|
||||
|
||||
# must login as root@localhost
|
||||
sudo mysql -h "127.0.0.1" -uroot -psecretmysql < /opt/monasca/sqls/mon.sql || echo "Did the schema change? This process will fail on schema changes."
|
||||
sudo mysql -u$DATABASE_USER -p$DATABASE_PASSWORD -h$MYSQL_HOST < /opt/monasca/sqls/mon.sql || echo "Did the schema change? This process will fail on schema changes."
|
||||
|
||||
sudo cp -f "${MONASCA_BASE}"/monasca-api/devstack/files/schema/winchester.sql /opt/monasca/sqls/winchester.sql
|
||||
|
||||
|
@ -749,7 +754,7 @@ function install_schema {
|
|||
sudo chown root:root /opt/monasca/sqls/winchester.sql
|
||||
|
||||
# must login as root@localhost
|
||||
sudo mysql -h "127.0.0.1" -uroot -psecretmysql < /opt/monasca/sqls/winchester.sql || echo "Did the schema change? This process will fail on schema changes."
|
||||
sudo mysql -u$DATABASE_USER -p$DATABASE_PASSWORD -h$MYSQL_HOST < /opt/monasca/sqls/winchester.sql || echo "Did the schema change? This process will fail on schema changes."
|
||||
|
||||
sudo mkdir -p /opt/kafka/logs || true
|
||||
|
||||
|
@ -770,9 +775,9 @@ function clean_schema {
|
|||
|
||||
echo_summary "Clean Monasca Schema"
|
||||
|
||||
sudo echo "drop database winchester;" | mysql -uroot -ppassword
|
||||
sudo echo "drop database winchester;" | mysql -u$DATABASE_USER -p$DATABASE_PASSWORD
|
||||
|
||||
sudo echo "drop database mon;" | mysql -uroot -ppassword
|
||||
sudo echo "drop database mon;" | mysql -u$DATABASE_USER -p$DATABASE_PASSWORD
|
||||
|
||||
sudo rm -f /opt/monasca/sqls/winchester.sql
|
||||
|
||||
|
|
Loading…
Reference in New Issue