From 003f765e914c5c5ae21e33b016e7cff7da8207d1 Mon Sep 17 00:00:00 2001 From: "Gupta, Sangeet (sg774j)" Date: Mon, 25 Mar 2019 11:56:05 -0500 Subject: [PATCH] Mariadb: Display error if user is not create This PS updates the create-mysql-user.sh to display the error if the exporter user was not created successfully. Change-Id: I03505b5fb569cda199c2803086b77206b810ea3f --- .../monitoring/prometheus/bin/_create-mysql-user.sh.tpl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mariadb/templates/monitoring/prometheus/bin/_create-mysql-user.sh.tpl b/mariadb/templates/monitoring/prometheus/bin/_create-mysql-user.sh.tpl index 85b30ce77..594880fa6 100644 --- a/mariadb/templates/monitoring/prometheus/bin/_create-mysql-user.sh.tpl +++ b/mariadb/templates/monitoring/prometheus/bin/_create-mysql-user.sh.tpl @@ -18,7 +18,10 @@ limitations under the License. set -e -mysql --defaults-file=/etc/mysql/admin_user.cnf -e \ +if ! mysql --defaults-file=/etc/mysql/admin_user.cnf -e \ "CREATE OR REPLACE USER '${EXPORTER_USER}'@'%' IDENTIFIED BY '${EXPORTER_PASSWORD}'; \ GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO '${EXPORTER_USER}'@'%'; \ - FLUSH PRIVILEGES;" + FLUSH PRIVILEGES;" ; then + echo "ERROR: Could not create user: ${EXPORTER_USER}" + exit 1 +fi