[SCM] Samba Shared Repository - branch master updated

Martin Schwenke martins at samba.org
Wed Jul 5 12:17:01 UTC 2023


The branch, master has been updated
       via  d2940694c6a ctdb-tests: Run ShellCheck on event-script unit test support scripts
       via  b2026e92d68 ctdb-tests: Avoid ShellCheck warnings
       via  a45a76fd19c ctdb-tests: Avoid ShellCheck warning SC2059
       via  58a117d3d57 ctdb-tests: Avoid ShellCheck warnings SC2046, SC2005
       via  1190c91090a ctdb-tests: Drop unreachable code
       via  cbda1a78dc8 ctdb-tests: Reformat with "shfmt -w -p -i 0 -fn"
       via  7813c979edb ctdb-tests: Drop unused test code for tunables
       via  92f17474484 ctdb-tests: Avoid ShellCheck warning SC2086
       via  37105addecc ctdb-scripts: Avoid ShellCheck warnings SC2317, SC2086
       via  aeb5b0adfa7 ctdb-tools: Avoid ShellCheck warning SC2317
      from  6965e77268e s3:libads: re-initialize num_requests to 0 for cldap_ping_list retries

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d2940694c6a1d7a842d5d91792f36974846da4e0
Author: Martin Schwenke <mschwenke at ddn.com>
Date:   Mon Jul 3 12:02:36 2023 +1000

    ctdb-tests: Run ShellCheck on event-script unit test support scripts
    
    Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Wed Jul  5 12:16:57 UTC 2023 on atb-devel-224

commit b2026e92d68c12e0b6169742954a706b6faa7bf8
Author: Martin Schwenke <mschwenke at ddn.com>
Date:   Mon Jul 3 09:32:26 2023 +1000

    ctdb-tests: Avoid ShellCheck warnings
    
    These are all trivial, so handle them in bulk.
    
    * Change code to avoid (approximately sorted by frequency):
    
      SC2004 $/${} is unnecessary on arithmetic variables.
      SC2086 Double quote to prevent globbing and word splitting.
      SC2162 read without -r will mangle backslashes.
      SC2254 Quote expansions in case patterns to match literally rather than as a glob.
      SC2154 (warning): <variable> is referenced but not assigned.
      SC3037 (warning): In POSIX sh, echo flags are undefined.
      SC2016 (info): Expressions don't expand in single quotes, use double quotes for that.
      SC2069 (warning): To redirect stdout+stderr, 2>&1 must be last (or use '{ cmd > file; } 2>&1' to clarify).
      SC2124 (warning): Assigning an array to a string! Assign as array, or use * instead of @ to concatenate.
      SC2166 (warning): Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
      SC2223 (info): This default assignment may cause DoS due to globbing. Quote it.
    
    * Locally disable checks:
    
      SC2034 (warning): <variable> appears unused. Verify use (or export if used externally).
      SC2086 (info): Double quote to prevent globbing and word splitting. [once]
      SC2120 (warning): <function> references arguments, but none are ever passed.
      SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
    
    While touching reads for SC2162, switch unused variables to "_"
    instead of "_x", which seems to be preferred by ShellCheck.
    
    Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit a45a76fd19ce486049583e1e7435320be40f9ef9
Author: Martin Schwenke <mschwenke at ddn.com>
Date:   Tue Jul 4 10:30:05 2023 +1000

    ctdb-tests: Avoid ShellCheck warning SC2059
    
      SC2059 (info): Don't use variables in the printf format string. Use printf '..%s..' "$foo".
    
    Move the format string to the function and just parameterise the share
    type.
    
    Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 58a117d3d57de416b946c91bf78107d507616e63
Author: Martin Schwenke <mschwenke at ddn.com>
Date:   Mon Jul 3 11:54:15 2023 +1000

    ctdb-tests: Avoid ShellCheck warnings SC2046, SC2005
    
    In ./tests/UNIT/eventscripts/scripts/local.sh line 328:
    	echo $(ctdb ifaces -X | awk -F'|' 'FNR > 1 {print $2}')
                 ^-- SC2046 (warning): Quote this to prevent word splitting.
                 ^-- SC2005 (style): Useless echo? Instead of 'echo $(cmd)', just use 'cmd'.
    
    Use xargs to get output on 1 line.
    
    Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 1190c91090a0b2ea718ebc5a48860d4362bf4c41
Author: Martin Schwenke <mschwenke at ddn.com>
Date:   Mon Jul 3 11:42:56 2023 +1000

    ctdb-tests: Drop unreachable code
    
    This generates ShellCheck warnings:
    
    In ./tests/UNIT/eventscripts/scripts/60.nfs.sh line 412:
    			if [ -n "$service_check_cmd" ]; then
                                     ^----------------^ SC2031 (info): service_check_cmd was modified in a subshell. That change might be lost.
    
    In ./tests/UNIT/eventscripts/scripts/60.nfs.sh line 413:
    				if eval "$service_check_cmd"; then
                                             ^----------------^ SC2031 (info): service_check_cmd was modified in a subshell. That change might be lost.
    
    service_check_cmd will never be set here because it is only set in a
    sub-shell in rpc_set_service_failure_response().
    
    This reverts some of commit 713ec217507d2f0d5f516efc45c8cd8773fccc14.
    
    If testcases requiring use of service_check_cmd are later added then
    this will need to be redone properly.  This would probably start by
    renaming this function nfs_iterate_rpc_test().
    
    Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit cbda1a78dc8a121e01e014144fe4f35ca83c2c62
Author: Martin Schwenke <mschwenke at ddn.com>
Date:   Mon Jul 3 09:26:34 2023 +1000

    ctdb-tests: Reformat with "shfmt -w -p -i 0 -fn"
    
    Best reviewed with "git show -w".
    
    Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 7813c979edb68606eb46324dd8263c432ed33fd3
Author: Martin Schwenke <mschwenke at ddn.com>
Date:   Fri Jun 16 13:28:40 2023 +1000

    ctdb-tests: Drop unused test code for tunables
    
    This is unused since loading tunables was moved to ctdbd.
    
    Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 92f17474484a975cef529b9b591f7cad9c66231f
Author: Martin Schwenke <mschwenke at ddn.com>
Date:   Mon Jul 3 12:10:28 2023 +1000

    ctdb-tests: Avoid ShellCheck warning SC2086
    
      SC2086 Double quote to prevent globbing and word splitting.
    
    Apparently ShellCheck is more picky about some of these than it used
    to be.
    
    Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 37105addecc804ecd1c187c19adf40e97472d6e1
Author: Martin Schwenke <mschwenke at ddn.com>
Date:   Mon Jul 3 13:34:58 2023 +1000

    ctdb-scripts: Avoid ShellCheck warnings SC2317, SC2086
    
    New in ShellCheck 0.9.0:
    
      SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
    
    Also:
    
      SC2086 (info): Double quote to prevent globbing and word splitting.
    
    Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit aeb5b0adfa7322602a4395ba8199fa2b05f0cf07
Author: Martin Schwenke <mschwenke at ddn.com>
Date:   Mon Jul 3 13:26:20 2023 +1000

    ctdb-tools: Avoid ShellCheck warning SC2317
    
    New in ShellCheck 0.9.0:
    
      SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
    
    Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 ctdb/config/events/legacy/05.system.script         |   2 +
 ctdb/config/events/legacy/40.vsftpd.script         |   4 +-
 ctdb/config/events/legacy/60.nfs.script            |   2 +
 .../UNIT/eventscripts/50.samba.monitor.105.sh      |   2 +-
 ctdb/tests/UNIT/eventscripts/60.nfs.monitor.161.sh |   2 +-
 ctdb/tests/UNIT/eventscripts/scripts/00.ctdb.sh    |   9 +-
 ctdb/tests/UNIT/eventscripts/scripts/01.reclock.sh |   6 +-
 ctdb/tests/UNIT/eventscripts/scripts/05.system.sh  |  16 +-
 ctdb/tests/UNIT/eventscripts/scripts/06.nfs.sh     |   2 +-
 .../UNIT/eventscripts/scripts/10.interface.sh      |  12 +-
 ctdb/tests/UNIT/eventscripts/scripts/11.natgw.sh   |  29 +-
 .../UNIT/eventscripts/scripts/13.per_ip_routing.sh |  35 +-
 .../UNIT/eventscripts/scripts/20.multipathd.sh     |   7 +-
 ctdb/tests/UNIT/eventscripts/scripts/31.clamd.sh   |   2 +-
 ctdb/tests/UNIT/eventscripts/scripts/40.vsftpd.sh  |   4 +-
 ctdb/tests/UNIT/eventscripts/scripts/41.httpd.sh   |   8 +-
 ctdb/tests/UNIT/eventscripts/scripts/48.netbios.sh |  10 +-
 ctdb/tests/UNIT/eventscripts/scripts/49.winbind.sh |   8 +-
 ctdb/tests/UNIT/eventscripts/scripts/50.samba.sh   |  18 +-
 ctdb/tests/UNIT/eventscripts/scripts/60.nfs.sh     | 145 ++++----
 ctdb/tests/UNIT/eventscripts/scripts/91.lvs.sh     |  14 +-
 .../tests/UNIT/eventscripts/scripts/debug_locks.sh | 139 ++++----
 ctdb/tests/UNIT/eventscripts/scripts/local.sh      | 382 +++++++++++----------
 .../UNIT/eventscripts/scripts/statd-callout.sh     |  26 +-
 ctdb/tests/UNIT/eventscripts/stubs/ctdb            |  23 --
 ctdb/tests/UNIT/shellcheck/tests.sh                |   3 +-
 ctdb/tests/local_daemons.sh                        |   4 +-
 ctdb/tests/run_tests.sh                            |   8 +-
 ctdb/tools/onnode                                  |   2 +
 29 files changed, 479 insertions(+), 445 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/config/events/legacy/05.system.script b/ctdb/config/events/legacy/05.system.script
index 56a07c7cc77..bf36dd21ffa 100755
--- a/ctdb/config/events/legacy/05.system.script
+++ b/ctdb/config/events/legacy/05.system.script
@@ -139,6 +139,8 @@ monitor_filesystem_usage()
 	done
 }
 
+# shellcheck disable=SC2317
+# Called indirectly via check_thresholds()
 dump_memory_info()
 {
 	get_proc "meminfo"
diff --git a/ctdb/config/events/legacy/40.vsftpd.script b/ctdb/config/events/legacy/40.vsftpd.script
index 19d40071ce2..1202812c3cd 100755
--- a/ctdb/config/events/legacy/40.vsftpd.script
+++ b/ctdb/config/events/legacy/40.vsftpd.script
@@ -10,7 +10,9 @@ service_name="vsftpd"
 
 service_reconfigure ()
 {
-    service $service_name restart
+	# shellcheck disable=SC2317
+	# Called indirectly via ctdb_service_reconfigure()
+	service "$service_name" restart
 }
 
 load_script_options
diff --git a/ctdb/config/events/legacy/60.nfs.script b/ctdb/config/events/legacy/60.nfs.script
index 8e496f73cc5..b7ae0746be5 100755
--- a/ctdb/config/events/legacy/60.nfs.script
+++ b/ctdb/config/events/legacy/60.nfs.script
@@ -19,6 +19,8 @@ ctdb_setup_state_dir "service" "$service_name"
 service_reconfigure ()
 {
     # Restart lock manager, notify clients
+    # shellcheck disable=SC2317
+    # Called indirectly via check_thresholds()
     if [ -x "${CTDB_BASE}/statd-callout" ] ; then
 	"${CTDB_BASE}/statd-callout" notify &
     fi >/dev/null 2>&1
diff --git a/ctdb/tests/UNIT/eventscripts/50.samba.monitor.105.sh b/ctdb/tests/UNIT/eventscripts/50.samba.monitor.105.sh
index 1f2fa1e9068..7208aca5eae 100755
--- a/ctdb/tests/UNIT/eventscripts/50.samba.monitor.105.sh
+++ b/ctdb/tests/UNIT/eventscripts/50.samba.monitor.105.sh
@@ -6,7 +6,7 @@ define_test "non-existent share path"
 
 setup
 
-out=$(shares_missing "ERROR: samba directory \"%s\" not available" 2)
+out=$(shares_missing "samba" 2)
 
 required_result 1 "$out"
 simple_test
diff --git a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.161.sh b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.161.sh
index ed080c2c4c8..1fa73bb8f91 100755
--- a/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.161.sh
+++ b/ctdb/tests/UNIT/eventscripts/60.nfs.monitor.161.sh
@@ -6,7 +6,7 @@ define_test "2nd share missing"
 
 setup
 
-out=$(shares_missing "ERROR: nfs directory \"%s\" not available" 2)
+out=$(shares_missing "nfs" 2)
 
 required_result 1 "$out"
 simple_test
diff --git a/ctdb/tests/UNIT/eventscripts/scripts/00.ctdb.sh b/ctdb/tests/UNIT/eventscripts/scripts/00.ctdb.sh
index 7925679cc47..a192e058edf 100644
--- a/ctdb/tests/UNIT/eventscripts/scripts/00.ctdb.sh
+++ b/ctdb/tests/UNIT/eventscripts/scripts/00.ctdb.sh
@@ -1,4 +1,4 @@
-setup ()
+setup()
 {
 	setup_dbdir
 	setup_date
@@ -15,12 +15,7 @@ setup ()
 	       "
 }
 
-setup_tunable_config ()
-{
-	cat >"${CTDB_BASE}/ctdb.tunables"
-}
-
-result_filter ()
+result_filter()
 {
 	_date="[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]"
 	_time="[0-9][0-9][0-9][0-9][0-9][0-9]"
diff --git a/ctdb/tests/UNIT/eventscripts/scripts/01.reclock.sh b/ctdb/tests/UNIT/eventscripts/scripts/01.reclock.sh
index cc1f086bb2c..7365dd8e114 100644
--- a/ctdb/tests/UNIT/eventscripts/scripts/01.reclock.sh
+++ b/ctdb/tests/UNIT/eventscripts/scripts/01.reclock.sh
@@ -1,13 +1,13 @@
-setup ()
+setup()
 {
-	if [ $# -eq 1 ] ; then
+	if [ $# -eq 1 ]; then
 		reclock="$1"
 	else
 		reclock="${CTDB_TEST_TMP_DIR}/reclock_subdir/rec.lock"
 	fi
 	CTDB_RECOVERY_LOCK="$reclock"
 
-	if [ -n "$CTDB_RECOVERY_LOCK" ] ; then
+	if [ -n "$CTDB_RECOVERY_LOCK" ]; then
 		cat >>"${CTDB_BASE}/ctdb.conf" <<EOF
 [cluster]
 	recovery lock = $CTDB_RECOVERY_LOCK
diff --git a/ctdb/tests/UNIT/eventscripts/scripts/05.system.sh b/ctdb/tests/UNIT/eventscripts/scripts/05.system.sh
index eaf3e989b9f..0191e55ab0a 100644
--- a/ctdb/tests/UNIT/eventscripts/scripts/05.system.sh
+++ b/ctdb/tests/UNIT/eventscripts/scripts/05.system.sh
@@ -1,16 +1,18 @@
-set_mem_usage ()
+# shellcheck disable=SC2120
+# Arguments used in testcases
+set_mem_usage()
 {
 	_mem_usage="${1:-10}" # Default is 10%
 	_swap_usage="${2:-0}" # Default is  0%
 
 	_swap_total=5857276
-	_swap_free=$(( (100 - $_swap_usage) * $_swap_total / 100 ))
+	_swap_free=$(((100 - _swap_usage) * _swap_total / 100))
 
 	_mem_total=3940712
 	_mem_free=225268
 	_mem_buffers=146120
-	_mem_cached=$(( $_mem_total * (100 - $_mem_usage) / 100 -
-			$_mem_free - $_mem_buffers ))
+	_mem_cached=$((_mem_total * (100 - _mem_usage) / 100 - \
+		_mem_free - _mem_buffers))
 
 	export FAKE_PROC_MEMINFO="\
 MemTotal:        ${_mem_total} kB
@@ -31,12 +33,12 @@ SwapFree:        ${_swap_free} kB
 ..."
 }
 
-set_fs_usage ()
+set_fs_usage()
 {
-	export FAKE_FS_USE="${1:-10}"  # Default is 10% usage
+	export FAKE_FS_USE="${1:-10}" # Default is 10% usage
 }
 
-setup ()
+setup()
 {
 	setup_dbdir
 
diff --git a/ctdb/tests/UNIT/eventscripts/scripts/06.nfs.sh b/ctdb/tests/UNIT/eventscripts/scripts/06.nfs.sh
index 48ee4895cf0..5912a4b858b 100644
--- a/ctdb/tests/UNIT/eventscripts/scripts/06.nfs.sh
+++ b/ctdb/tests/UNIT/eventscripts/scripts/06.nfs.sh
@@ -1,4 +1,4 @@
-setup ()
+setup()
 {
 	:
 }
diff --git a/ctdb/tests/UNIT/eventscripts/scripts/10.interface.sh b/ctdb/tests/UNIT/eventscripts/scripts/10.interface.sh
index b2bc87ed558..579f3ee7a9b 100644
--- a/ctdb/tests/UNIT/eventscripts/scripts/10.interface.sh
+++ b/ctdb/tests/UNIT/eventscripts/scripts/10.interface.sh
@@ -1,9 +1,9 @@
-setup ()
+setup()
 {
 	setup_public_addresses
 }
 
-_tcp_connections ()
+_tcp_connections()
 {
 	_count="$1"
 	_sip="$2"
@@ -14,7 +14,7 @@ _tcp_connections ()
 	_cip_prefix="${_cip_base%.*}"
 	_cip_suffix="${_cip_base##*.}"
 
-	for _i in $(seq 1 $_count) ; do
+	for _i in $(seq 1 "$_count"); do
 		_cip_last=$((_cip_suffix + _i))
 		_cip="${_cip_prefix}.${_cip_last}"
 		_cport=$((_cport_base + _i))
@@ -22,14 +22,14 @@ _tcp_connections ()
 	done
 }
 
-setup_tcp_connections ()
+setup_tcp_connections()
 {
 	_t="${FAKE_NETWORK_STATE}/tcp-established"
 	export FAKE_NETSTAT_TCP_ESTABLISHED_FILE="$_t"
 	_tcp_connections "$@" >"$FAKE_NETSTAT_TCP_ESTABLISHED_FILE"
 }
 
-setup_tcp_connections_unkillable ()
+setup_tcp_connections_unkillable()
 {
 	# These connections are listed by the "ss" stub but are not
 	# killed by the "ctdb killtcp" stub.  So killing these
@@ -44,7 +44,7 @@ setup_tcp_connections_unkillable ()
 
 # arg1 is interface name, arg2 is currently active slave (use "None"
 # if none), arg3 is MII status ("up" or "down").
-setup_bond ()
+setup_bond()
 {
 	_iface="$1"
 	_slave="${2:-${_iface}_sl_0}"
diff --git a/ctdb/tests/UNIT/eventscripts/scripts/11.natgw.sh b/ctdb/tests/UNIT/eventscripts/scripts/11.natgw.sh
index 511dc27a694..3b198951279 100644
--- a/ctdb/tests/UNIT/eventscripts/scripts/11.natgw.sh
+++ b/ctdb/tests/UNIT/eventscripts/scripts/11.natgw.sh
@@ -1,4 +1,4 @@
-setup ()
+setup()
 {
 	debug "Setting up NAT gateway"
 
@@ -9,10 +9,10 @@ setup ()
 
 # A separate function for this makes sense because it can be done
 # multiple times per test
-setup_ctdb_natgw ()
+setup_ctdb_natgw()
 {
 	# Read from stdin
-	while read _ip _opts ; do
+	while read -r _ip _opts; do
 		case "$_opts" in
 		leader)
 			export FAKE_CTDB_NATGW_LEADER="$_ip"
@@ -29,7 +29,7 @@ setup_ctdb_natgw ()
 
 	# Assume all of the nodes are on a /24 network and have IPv4
 	# addresses:
-	read _ip <"$natgw_nodes"
+	read -r _ip <"$natgw_nodes"
 
 	setup_script_options <<EOF
 CTDB_NATGW_NODES="$natgw_nodes"
@@ -43,11 +43,11 @@ CTDB_NATGW_DEFAULT_GATEWAY="10.1.1.254"
 EOF
 }
 
-ok_natgw_leader_ip_addr_show ()
+ok_natgw_leader_ip_addr_show()
 {
 	_mac=$(echo "$CTDB_NATGW_PUBLIC_IFACE" |
-	       cksum |
-	       sed -r -e 's@(..)(..)(..).*@fe:fe:fe:\1:\2:\3@')
+		cksum |
+		sed -r -e 's@(..)(..)(..).*@fe:fe:fe:\1:\2:\3@')
 
 	# This is based on CTDB_NATGW_PUBLIC_IP
 	_brd="10.1.1.255"
@@ -60,11 +60,11 @@ ok_natgw_leader_ip_addr_show ()
 EOF
 }
 
-ok_natgw_follower_ip_addr_show ()
+ok_natgw_follower_ip_addr_show()
 {
 	_mac=$(echo "$CTDB_NATGW_PUBLIC_IFACE" |
-	       cksum |
-	       sed -r -e 's@(..)(..)(..).*@fe:fe:fe:\1:\2:\3@')
+		cksum |
+		sed -r -e 's@(..)(..)(..).*@fe:fe:fe:\1:\2:\3@')
 
 	ok <<EOF
 1: ${CTDB_NATGW_PUBLIC_IFACE}: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
@@ -72,12 +72,12 @@ ok_natgw_follower_ip_addr_show ()
 EOF
 }
 
-ok_natgw_leader_static_routes ()
+ok_natgw_leader_static_routes()
 {
 	_nl="
 "
 	_t=""
-	for _i in $CTDB_NATGW_STATIC_ROUTES ; do
+	for _i in $CTDB_NATGW_STATIC_ROUTES; do
 		# This is intentionally different to the code in 11.natgw ;-)
 		case "$_i" in
 		*@*)
@@ -87,6 +87,7 @@ ok_natgw_leader_static_routes ()
 		*)
 			_net="$_i"
 			_gw="$CTDB_NATGW_DEFAULT_GATEWAY"
+			;;
 		esac
 
 		[ -n "$_gw" ] || continue
@@ -97,12 +98,12 @@ ok_natgw_leader_static_routes ()
 	ok "$_t"
 }
 
-ok_natgw_follower_static_routes ()
+ok_natgw_follower_static_routes()
 {
 	_nl="
 "
 	_t=""
-	for _i in $CTDB_NATGW_STATIC_ROUTES ; do
+	for _i in $CTDB_NATGW_STATIC_ROUTES; do
 		# This is intentionally different to the code in 11.natgw ;-)
 		_net=$(echo "$_i" | sed -e 's|@.*||')
 
diff --git a/ctdb/tests/UNIT/eventscripts/scripts/13.per_ip_routing.sh b/ctdb/tests/UNIT/eventscripts/scripts/13.per_ip_routing.sh
index e57e91a50c2..aac2c3d835d 100644
--- a/ctdb/tests/UNIT/eventscripts/scripts/13.per_ip_routing.sh
+++ b/ctdb/tests/UNIT/eventscripts/scripts/13.per_ip_routing.sh
@@ -1,7 +1,9 @@
-setup ()
+setup()
 {
 	setup_public_addresses
 
+	# shellcheck disable=SC2034
+	# Used in expected output
 	service_name="per_ip_routing"
 
 	setup_script_options <<EOF
@@ -18,25 +20,28 @@ EOF
 # Create policy routing configuration in $CTDB_PER_IP_ROUTING_CONF.
 # $1 is the number of assigned IPs to use (<num>, all), defaulting to
 # 1.  If $2 is "default" then a default route is also added.
-create_policy_routing_config ()
+create_policy_routing_config()
 {
 	_num_ips="${1:-1}"
 	_should_add_default="$2"
 
 	ctdb_get_my_public_addresses |
-	if [ "$_num_ips" = "all" ] ; then
-		cat
-	else
-		{ head -n "$_num_ips" ; cat >/dev/null ; }
-	fi |
-	while read _dev _ip _bits ; do
-		_net=$(ipv4_host_addr_to_net "$_ip" "$_bits")
-		_gw="${_net%.*}.254" # a dumb, calculated default
+		if [ "$_num_ips" = "all" ]; then
+			cat
+		else
+			{
+				head -n "$_num_ips"
+				cat >/dev/null
+			}
+		fi |
+		while read -r _dev _ip _bits; do
+			_net=$(ipv4_host_addr_to_net "$_ip" "$_bits")
+			_gw="${_net%.*}.254" # a dumb, calculated default
 
-		echo "$_ip $_net"
+			echo "$_ip $_net"
 
-		if [ "$_should_add_default" = "default" ] ; then
-			echo "$_ip 0.0.0.0/0 $_gw"
-		fi
-	done >"$CTDB_PER_IP_ROUTING_CONF"
+			if [ "$_should_add_default" = "default" ]; then
+				echo "$_ip 0.0.0.0/0 $_gw"
+			fi
+		done >"$CTDB_PER_IP_ROUTING_CONF"
 }
diff --git a/ctdb/tests/UNIT/eventscripts/scripts/20.multipathd.sh b/ctdb/tests/UNIT/eventscripts/scripts/20.multipathd.sh
index 2a69ae868b4..9add0bca209 100644
--- a/ctdb/tests/UNIT/eventscripts/scripts/20.multipathd.sh
+++ b/ctdb/tests/UNIT/eventscripts/scripts/20.multipathd.sh
@@ -1,16 +1,17 @@
-setup ()
+setup()
 {
 	_failures=""
 	_devices=""
-	for i ; do
+	for i; do
 		case "$i" in
 		\!*)
 			_t="${i#!}"
 			echo "Marking ${_t} as having no active paths"
 			_failures="${_failures}${_failures:+ }${_t}"
-		;;
+			;;
 		*)
 			_t="$i"
+			;;
 		esac
 		_devices="${_devices}${_devices:+ }${_t}"
 	done
diff --git a/ctdb/tests/UNIT/eventscripts/scripts/31.clamd.sh b/ctdb/tests/UNIT/eventscripts/scripts/31.clamd.sh
index 8fe3bbc6186..27016cb296c 100644
--- a/ctdb/tests/UNIT/eventscripts/scripts/31.clamd.sh
+++ b/ctdb/tests/UNIT/eventscripts/scripts/31.clamd.sh
@@ -1,4 +1,4 @@
-setup ()
+setup()
 {
 	setup_script_options <<EOF
 CTDB_CLAMD_SOCKET="/var/run/clamd.sock"
diff --git a/ctdb/tests/UNIT/eventscripts/scripts/40.vsftpd.sh b/ctdb/tests/UNIT/eventscripts/scripts/40.vsftpd.sh
index de2aa263c21..2d26b6f1bcb 100644
--- a/ctdb/tests/UNIT/eventscripts/scripts/40.vsftpd.sh
+++ b/ctdb/tests/UNIT/eventscripts/scripts/40.vsftpd.sh
@@ -1,10 +1,10 @@
-setup ()
+setup()
 {
 	debug "Setting up VSFTPD environment: service $1, not managed by CTDB"
 
 	_service_name="vsftpd"
 
-	if [ "$1" != "down" ] ; then
+	if [ "$1" != "down" ]; then
 		service "$_service_name" start
 	else
 		service "$_service_name" force-stopped
diff --git a/ctdb/tests/UNIT/eventscripts/scripts/41.httpd.sh b/ctdb/tests/UNIT/eventscripts/scripts/41.httpd.sh
index 9b4a9ad6342..3fac4f0952a 100644
--- a/ctdb/tests/UNIT/eventscripts/scripts/41.httpd.sh
+++ b/ctdb/tests/UNIT/eventscripts/scripts/41.httpd.sh
@@ -1,13 +1,13 @@
-setup ()
+setup()
 {
 	debug "Setting up HTTPD environment: service $1, not managed by CTDB"
 
-	if [ "$1" != "down" ] ; then
-		for _service_name in "apache2" "httpd" ; do
+	if [ "$1" != "down" ]; then
+		for _service_name in "apache2" "httpd"; do
 			service "$_service_name" start
 		done
 	else
-		for _service_name in "apache2" "httpd" ; do
+		for _service_name in "apache2" "httpd"; do
 			service "$_service_name" force-stopped
 		done
 	fi
diff --git a/ctdb/tests/UNIT/eventscripts/scripts/48.netbios.sh b/ctdb/tests/UNIT/eventscripts/scripts/48.netbios.sh
index f578399a3cd..6efcd8ada87 100644
--- a/ctdb/tests/UNIT/eventscripts/scripts/48.netbios.sh
+++ b/ctdb/tests/UNIT/eventscripts/scripts/48.netbios.sh
@@ -1,20 +1,22 @@
-setup ()
+setup()
 {
+	# shellcheck disable=SC2034
+	# Used in expected output
 	service_name="netbios"
 
-	if [ "$1" != "down" ] ; then
+	if [ "$1" != "down" ]; then
 
 		debug "Marking Netbios name services as up, listening and managed by CTDB"
 
 		# All possible service names for all known distros.
-		for i in "nmb" "nmbd" ; do
+		for i in "nmb" "nmbd"; do
 			service "$i" force-started
 		done
 	else
 		debug "Marking Netbios name services as down, not listening and not managed by CTDB"
 
 		# All possible service names for all known distros.
-		for i in "nmb" "nmbd" ; do
+		for i in "nmb" "nmbd"; do
 			service "$i" force-stopped
 		done
 	fi
diff --git a/ctdb/tests/UNIT/eventscripts/scripts/49.winbind.sh b/ctdb/tests/UNIT/eventscripts/scripts/49.winbind.sh
index e9bbe31faf5..bbe1de2a8d7 100644
--- a/ctdb/tests/UNIT/eventscripts/scripts/49.winbind.sh
+++ b/ctdb/tests/UNIT/eventscripts/scripts/49.winbind.sh
@@ -1,8 +1,10 @@
-setup ()
+setup()
 {
+	# shellcheck disable=SC2034
+	# Used in expected output
 	service_name="winbind"
 
-	if [ "$1" != "down" ] ; then
+	if [ "$1" != "down" ]; then
 
 		debug "Marking Winbind service as up and managed by CTDB"
 
@@ -19,7 +21,7 @@ setup ()
 	fi
 }
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list