mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
wsrep_sst_common: parse --address and split WSREP_SST_OPT_PATH
Use the string functionality of sh to split the address: IPv6 test: . scripts/wsrep_sst_common.sh --address [ipv6]:port/module/lsn_version/sst_ver/some_future_option1/some_future_option2 $ set | grep WSREP_SST WSREP_SST_OPT_ADDR='[ipv6]:port/module/lsn_version/sst_ver/some_future_option1/some_future_option2' WSREP_SST_OPT_AUTH= WSREP_SST_OPT_BINLOG= WSREP_SST_OPT_BYPASS=0 WSREP_SST_OPT_CONF=' ' WSREP_SST_OPT_DATA= WSREP_SST_OPT_DEFAULT= WSREP_SST_OPT_EXTRA_DEFAULT= WSREP_SST_OPT_HOST='[ipv6]' WSREP_SST_OPT_HOST_UNESCAPED=ipv6 WSREP_SST_OPT_LSN=lsn_version WSREP_SST_OPT_MODULE=module WSREP_SST_OPT_PATH=module/lsn_version/sst_ver/some_future_option1/some_future_option2 WSREP_SST_OPT_PORT=port WSREP_SST_OPT_PSWD= WSREP_SST_OPT_SST_VER=sst_ver WSREP_SST_OPT_SUFFIX_DEFAULT= WSREP_SST_OPT_USER= IPv4 test: . scripts/wsrep_sst_common.sh --address ipv4:port/module/lsn_version/sst_ver/some_future_option1/some_future_option2 $ set | grep WSREP_SST WSREP_SST_OPT_ADDR=ipv4:port/module/lsn_version/sst_ver/some_future_option1/some_future_option2 WSREP_SST_OPT_AUTH= WSREP_SST_OPT_BINLOG= WSREP_SST_OPT_BYPASS=0 WSREP_SST_OPT_CONF=' ' WSREP_SST_OPT_DATA= WSREP_SST_OPT_DEFAULT= WSREP_SST_OPT_EXTRA_DEFAULT= WSREP_SST_OPT_HOST=ipv4 WSREP_SST_OPT_LSN=lsn_version WSREP_SST_OPT_MODULE=module WSREP_SST_OPT_PATH=module/lsn_version/sst_ver/some_future_option1/some_future_option2 WSREP_SST_OPT_PORT=port WSREP_SST_OPT_PSWD= WSREP_SST_OPT_SST_VER=sst_ver WSREP_SST_OPT_SUFFIX_DEFAULT= WSREP_SST_OPT_USER=
This commit is contained in:
parent
95e5fe6732
commit
e78e308e81
1 changed files with 8 additions and 7 deletions
|
@ -35,19 +35,20 @@ case "$1" in
|
|||
#
|
||||
# Break address string into host:port/path parts
|
||||
#
|
||||
if echo $WSREP_SST_OPT_ADDR | grep -qe '^\[.*\]'
|
||||
readonly WSREP_SST_OPT_HOST=${WSREP_SST_OPT_ADDR%%[:/]*}
|
||||
if [ ${WSREP_SST_OPT_HOST:0:1} = '[' ]
|
||||
then
|
||||
# IPv6 notation
|
||||
readonly WSREP_SST_OPT_HOST=${WSREP_SST_OPT_ADDR/\]*/\]}
|
||||
readonly WSREP_SST_OPT_HOST_UNESCAPED=$(echo $WSREP_SST_OPT_HOST | \
|
||||
cut -d '[' -f 2 | cut -d ']' -f 1)
|
||||
else
|
||||
# "traditional" notation
|
||||
readonly WSREP_SST_OPT_HOST=${WSREP_SST_OPT_ADDR%%[:/]*}
|
||||
readonly WSREP_SST_OPT_HOST_UNESCAPED=${WSREP_SST_OPT_HOST:1:-1}
|
||||
fi
|
||||
readonly WSREP_SST_OPT_PORT=$(echo $WSREP_SST_OPT_ADDR | \
|
||||
cut -d ']' -f 2 | cut -s -d ':' -f 2 | cut -d '/' -f 1)
|
||||
readonly WSREP_SST_OPT_PATH=${WSREP_SST_OPT_ADDR#*/}
|
||||
readonly WSREP_SST_OPT_MODULE=${WSREP_SST_OPT_PATH%%/*}
|
||||
remain=${WSREP_SST_OPT_PATH#*/}
|
||||
readonly WSREP_SST_OPT_LSN=${remain%%/*}
|
||||
remain=${remain#*/}
|
||||
readonly WSREP_SST_OPT_SST_VER=${remain%%/*}
|
||||
shift
|
||||
;;
|
||||
'--bypass')
|
||||
|
|
Loading…
Reference in a new issue