eventscripts: Simplify handling of $service name in start/stop functions
authorMartin Schwenke <martin@meltin.net>
Mon, 29 Apr 2013 17:18:01 +0000 (03:18 +1000)
committerAmitay Isaacs <amitay@gmail.com>
Mon, 6 May 2013 05:45:10 +0000 (15:45 +1000)
Complicated argument handling was introduced to deal with multiple
services per eventscript.  This was a failure and we split 50.samba.

This simplifies several functions to use global $service_name
unconditionally instead of having an optional argument.

Signed-off-by: Martin Schwenke <martin@meltin.net>
config/functions

index 5254bd4c3a72c89335826be29a9e10cae02dab51..245e47a1f74dc83f2d5d021f7181a69c434361b5 100755 (executable)
@@ -1341,20 +1341,18 @@ ctdb_start_stop_service ()
 ctdb_service_start ()
 {
     # The service is marked managed if we've ever tried to start it.
-    ctdb_service_managed "$@"
+    ctdb_service_managed
 
-    # Here we only want $1.  If no argument is passed then
-    # service_start needs to know.
-    service_start "$@" || return $?
+    service_start || return $?
 
-    ctdb_counter_init "$@"
+    ctdb_counter_init
     ctdb_check_tcp_init
 }
 
 ctdb_service_stop ()
 {
-    ctdb_service_unmanaged "$@"
-    service_stop "$@"
+    ctdb_service_unmanaged
+    service_stop
 }
 
 # Default service_start() and service_stop() functions.
@@ -1369,12 +1367,12 @@ ctdb_service_stop ()
 # them with the service name as an argument.
 service_start ()
 {
-    service "${1:-${service_name}}" start
+    service "$service_name" start
 }
 
 service_stop ()
 {
-    service "${1:-${service_name}}" stop
+    service "$service_name" stop
 }
 
 ##################################################################