1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-11 16:58:40 +03:00

ctdb-tests: Support commenting out local daemons configuration options

Can be used to disable default options, such as cluster lock.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2022-01-14 13:59:25 +11:00 committed by Martin Schwenke
parent 34d2ca0ae6
commit 5d31778149

View File

@ -123,6 +123,7 @@ local_daemons_setup_usage ()
$0 <directory> setup [ <options>... ]
Options:
-C Comment out given config item (default: item uncommented)
-F Disable failover (default: failover enabled)
-N <file> Nodes file (default: automatically generated)
-n <num> Number of nodes (default: 3)
@ -138,6 +139,7 @@ EOF
local_daemons_setup ()
{
_commented_config=""
_disable_failover=false
_nodes_file=""
_num_nodes=3
@ -149,8 +151,11 @@ local_daemons_setup ()
set -e
while getopts "FN:n:P:Rr:S:6h?" _opt ; do
while getopts "C:FN:n:P:Rr:S:6h?" _opt ; do
case "$_opt" in
C) _t="${_commented_config}${_commented_config:+|}"
_commented_config="${_t}${OPTARG}"
;;
F) _disable_failover=true ;;
N) _nodes_file="$OPTARG" ;;
n) _num_nodes="$OPTARG" ;;
@ -255,6 +260,15 @@ local_daemons_setup ()
[event]
debug script = debug-hung-script.sh
EOF
(
IFS='|'
for _c in $_commented_config ; do
# Quote all backslashes due to double-quotes
sed -i -e "s|^\\t\\(${_c}\\) = |\\t# \\1 = |" \
"${CTDB_BASE}/ctdb.conf"
done
)
done
}