From: Martin Schwenke Date: Fri, 2 Mar 2018 09:36:39 +0000 (+1100) Subject: ctdb-tests: Make fake ssh script set CTDB_BASE X-Git-Tag: talloc-2.1.12~205 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=85598480fbb3a994b853bcd44438d6da85d8f4f3;p=thirdparty%2Fsamba.git ctdb-tests: Make fake ssh script set CTDB_BASE The local daemons code puts the socket in the CTDB_BASE directory. This means CTDB_NODES_SOCKETS can be replaced by CTDB_BASES, a list of base directories. The fake ssh script can first determine the correct CTDB_BASE directory and then use it to set CTDB_SOCKET and CTDB_PIDFILE. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/simple/scripts/local_daemons.bash b/ctdb/tests/simple/scripts/local_daemons.bash index 2a4704b21dc..a0fae2a32d4 100644 --- a/ctdb/tests/simple/scripts/local_daemons.bash +++ b/ctdb/tests/simple/scripts/local_daemons.bash @@ -301,14 +301,14 @@ ps_ctdbd () echo } -# onnode will use CTDB_NODES_SOCKETS to help the ctdb tool connection -# to each daemon -export CTDB_NODES_SOCKETS="" +# onnode will use CTDB_BASES to help the ctdb tool connection to each +# daemon +export CTDB_BASES="" for i in $(seq 0 $(($TEST_LOCAL_DAEMONS - 1))) ; do - socket=$(node_socket "$i") - CTDB_NODES_SOCKETS="${CTDB_NODES_SOCKETS}${CTDB_NODES_SOCKETS:+ }${socket}" + node_dir=$(node_dir "$i") + CTDB_BASES="${CTDB_BASES}${CTDB_BASES:+ }${node_dir}" done # Need a default CTDB_BASE for onnode (to find the functions file). # Any node will do, so pick the 1st... -export CTDB_BASE=$(node_dir 0) +export CTDB_BASE="${CTDB_BASES%% *}" diff --git a/ctdb/tests/simple/scripts/ssh_local_daemons.sh b/ctdb/tests/simple/scripts/ssh_local_daemons.sh index ecf5ee952f2..f0c364c36db 100755 --- a/ctdb/tests/simple/scripts/ssh_local_daemons.sh +++ b/ctdb/tests/simple/scripts/ssh_local_daemons.sh @@ -23,20 +23,24 @@ command="$2" num=$(awk -v ip="$ip" '$1 == ip { print NR }' "$nodes") pnn=$((num - 1)) -# Determine the correct Unix domain socket -export CTDB_SOCKET="" +# Determine the correct CTDB base directory +export CTDB_BASE="" n=0 -for s in $CTDB_NODES_SOCKETS ; do +for b in $CTDB_BASES ; do if [ $n -eq $pnn ] ; then - CTDB_SOCKET="$s" + CTDB_BASE="$b" break fi n=$((n + 1)) done -if [ -z "$CTDB_SOCKET" ] ; then - echo "$0: Unable to find socket for node ${ip}" >&2 + +if [ -z "$CTDB_BASE" ] ; then + echo "$0: Unable to find base for node ${ip}" >&2 exit 1 fi +export CTDB_SOCKET="${CTDB_BASE}/ctdbd.socket" +export CTDB_PIDFILE="${CTDB_BASE}/ctdbd.pid" + # Now exec sh -c "$command"