summaryrefslogtreecommitdiff
path: root/scripts/wsrep_sst_common.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/wsrep_sst_common.sh')
-rw-r--r--scripts/wsrep_sst_common.sh39
1 files changed, 28 insertions, 11 deletions
diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh
index 46f4076111f..0aa338510e0 100644
--- a/scripts/wsrep_sst_common.sh
+++ b/scripts/wsrep_sst_common.sh
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2014 Codership Oy
+# Copyright (C) 2012-2015 Codership Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -20,8 +20,11 @@ set -u
WSREP_SST_OPT_BYPASS=0
WSREP_SST_OPT_BINLOG=""
+WSREP_SST_OPT_CONF_SUFFIX=""
WSREP_SST_OPT_DATA=""
-WSREP_SST_OPT_AUTH=""
+WSREP_SST_OPT_AUTH=${WSREP_SST_OPT_AUTH:-}
+WSREP_SST_OPT_USER=${WSREP_SST_OPT_USER:-}
+WSREP_SST_OPT_PSWD=${WSREP_SST_OPT_PSWD:-}
while [ $# -gt 0 ]; do
case "$1" in
@@ -29,10 +32,6 @@ case "$1" in
readonly WSREP_SST_OPT_ADDR="$2"
shift
;;
- '--auth')
- WSREP_SST_OPT_AUTH="$2"
- shift
- ;;
'--bypass')
WSREP_SST_OPT_BYPASS=1
;;
@@ -45,7 +44,7 @@ case "$1" in
shift
;;
'--defaults-group-suffix')
- readonly WSREP_SST_OPT_CONF_SUFFIX="$2"
+ WSREP_SST_OPT_CONF_SUFFIX="$2"
shift
;;
'--host')
@@ -97,6 +96,7 @@ shift
done
readonly WSREP_SST_OPT_BYPASS
readonly WSREP_SST_OPT_BINLOG
+readonly WSREP_SST_OPT_CONF_SUFFIX
# try to use my_print_defaults, mysql and mysqldump that come with the sources
# (for MTR suite)
@@ -124,12 +124,30 @@ else
MY_PRINT_DEFAULTS=$(which my_print_defaults)
fi
+wsrep_auth_not_set()
+{
+ [ -z "$WSREP_SST_OPT_AUTH" -o "$WSREP_SST_OPT_AUTH" = "(null)" ]
+}
+
# For Bug:1200727
-if $MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF sst | grep -q "wsrep_sst_auth";then
- if [ -z "$WSREP_SST_OPT_AUTH" -o "$WSREP_SST_OPT_AUTH" = "(null)" ];then
- WSREP_SST_OPT_AUTH=$(my_print_defaults -c $WSREP_SST_OPT_CONF sst | grep -- "--wsrep_sst_auth" | cut -d= -f2)
+if $MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF sst | grep -q "wsrep_sst_auth"
+then
+ if wsrep_auth_not_set
+ then
+ WSREP_SST_OPT_AUTH=$(MY_PRINT_DEFAULTS -c $WSREP_SST_OPT_CONF sst | grep -- "--wsrep_sst_auth" | cut -d= -f2)
fi
fi
+readonly WSREP_SST_OPT_AUTH
+
+# Splitting AUTH into potential user:password pair
+if ! wsrep_auth_not_set
+then
+ readonly AUTH_VEC=(${WSREP_SST_OPT_AUTH//:/ })
+ WSREP_SST_OPT_USER="${AUTH_VEC[0]:-}"
+ WSREP_SST_OPT_PSWD="${AUTH_VEC[1]:-}"
+fi
+readonly WSREP_SST_OPT_USER
+readonly WSREP_SST_OPT_PSWD
if [ -n "${WSREP_SST_OPT_DATA:-}" ]
then
@@ -138,7 +156,6 @@ else
SST_PROGRESS_FILE=""
fi
-
wsrep_log()
{
# echo everything to stderr so that it gets into common error log