ctdb-scripts: Avoid shellcheck warnings SC2119, SC2120 (function arguments)
authorMartin Schwenke <martin@meltin.net>
Wed, 6 Jul 2016 10:25:57 +0000 (20:25 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 21 Jul 2016 00:24:26 +0000 (02:24 +0200)
SC2119: Use FUNC "$@" if function's $1 should meanscript's $1.
SC2120: FUNC references arguments, but none are ever passed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/config/ctdbd_wrapper
ctdb/config/functions

index 4d0dde7e0a9181ddae90b89c6aa5fbaad07f025d..367bc4a104ad0754d977e9997f99eb2c0f0d6737 100755 (executable)
@@ -114,6 +114,8 @@ dbdir_tmpfs_stop ()
     fi
 }
 
+# Only the nested function references its arguments
+# shellcheck disable=SC2120
 build_ctdb_options ()
 {
     ctdb_options=""
@@ -202,6 +204,8 @@ start()
 
     dbdir_tmpfs_start
 
+    # build_ctdb_options() takes no arguments
+    # shellcheck disable=SC2119
     build_ctdb_options
 
     export_debug_variables
index 3db3c8acbc0810387c42f31bb42ab16bdaf4aaec..2768d3f048701fc8a612046e1ddc22ead7a9151f 100755 (executable)
@@ -759,6 +759,8 @@ _ctdb_counter_common () {
     _counter_file="${CTDB_SCRIPT_VARDIR}/failcount/${_service_name}"
     mkdir -p "${_counter_file%/*}" # dirname
 }
+# Some code passes an argument
+# shellcheck disable=SC2120
 ctdb_counter_init () {
     _ctdb_counter_common "$1"
 
@@ -849,6 +851,8 @@ ctdb_service_reconfigure ()
     echo "Reconfiguring service \"${service_name}\"..."
     ctdb_service_unset_reconfigure
     service_reconfigure || return $?
+    # Intentionally have this use $service_name as default
+    # shellcheck disable=SC2119
     ctdb_counter_init
 }
 
@@ -1085,6 +1089,8 @@ ctdb_service_start ()
 
     service_start || return $?
 
+    # Intentionally have this use $service_name as default
+    # shellcheck disable=SC2119
     ctdb_counter_init
     ctdb_check_tcp_init
 }