File 0001-galera-Use-no-defaults-when-calling-mysql-client-for.patch of Package resource-agents.11510

From b0c4bed01d7aee0655e200c3ffd24b70e58c231d Mon Sep 17 00:00:00 2001
From: Thomas Bechtold <tbechtold@suse.com>
Date: Mon, 13 May 2019 16:30:31 +0200
Subject: [PATCH] galera: Use --no-defaults when calling mysql client for
 checks

When using a custom "check_user" without a "check_password" *and* the
user has a .my.cnf file in its home directory, the monitoring fails
like:

Operation promote for galera:0 (ocf:heartbeat:galera) returned: 'unknown error' (1)
 >  stderr: INFO: Node <d52-54-77-77-01-02> is bootstrapping the cluster
 >  stderr: ERROR: MySQL is not running
 >  stderr: INFO: Waiting on node <d52-54-77-77-01-01> to report database status before Master instances can start.
 >  stderr: INFO: MySQL is not running
 >  stderr: INFO: MySQL is not running
 >  stderr: ERROR 1045 (28000): Access denied for user 'monitoring'@'localhost' (using password: YES)
 >  stderr: ocf-exit-reason:Unable to retrieve wsrep_cluster_status, verify check_user 'monitoring' has permissions to view status
 >  stderr: ocf-exit-reason:local node <d52-54-77-77-01-02> is started, but not in primary mode. Unknown state.
 >  stderr: ocf-exit-reason:Failed initial monitor action

This happens because the credentials from ~/.my.cnf are used. Adding
the "--no-defaults" parameter to the mysql client call solves this.
---
 heartbeat/galera | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/heartbeat/galera b/heartbeat/galera
index d83a96d7..2005e1c2 100755
--- a/heartbeat/galera
+++ b/heartbeat/galera
@@ -954,7 +954,7 @@ if [ -z "${OCF_RESKEY_check_user}" ]; then
 fi
 : ${OCF_RESKEY_check_user="root"}
 
-MYSQL_OPTIONS_CHECK="-nNE --user=${OCF_RESKEY_check_user}"
+MYSQL_OPTIONS_CHECK="--no-defaults -nNE --user=${OCF_RESKEY_check_user}"
 if [ -n "${OCF_RESKEY_check_passwd}" ]; then
     MYSQL_OPTIONS_CHECK="$MYSQL_OPTIONS_CHECK --password=${OCF_RESKEY_check_passwd}"
 fi
-- 
2.21.0

openSUSE Build Service is sponsored by