Eventscripts - call ctdb_check_args() instead of doing hand checking
authorMartin Schwenke <martin@meltin.net>
Tue, 23 Aug 2011 06:36:19 +0000 (16:36 +1000)
committerMartin Schwenke <martin@meltin.net>
Mon, 29 Aug 2011 23:33:47 +0000 (09:33 +1000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
config/events.d/10.interface
config/events.d/13.per_ip_routing

index f75e6afea4e90435af1ce44337361c0c0e3d07f5..356ee08245f57e55ecf931e3af2fcbebb92b9f40 100755 (executable)
@@ -129,6 +129,8 @@ monitor_interfaces()
        return 1
 }
 
+ctdb_check_args "$@"
+
 case "$1" in 
      #############################
      # called when ctdbd starts up
@@ -158,10 +160,6 @@ case "$1" in
      ################################################
      # called when ctdbd wants to claim an IP address
      takeip)
-       if [ $# != 4 ]; then
-          echo "ERROR: must supply interface, IP and maskbits"
-          exit 1
-       fi
        iface=$2
        ip=$3
        maskbits=$4
@@ -181,11 +179,6 @@ case "$1" in
      ##################################################
      # called when ctdbd wants to release an IP address
      releaseip)
-       if [ $# != 4 ]; then
-          echo "ERROR: must supply interface, IP and maskbits"
-          exit 1
-       fi
-
        # releasing an IP is a bit more complex than it seems. Once the IP
        # is released, any open tcp connections to that IP on this host will end
        # up being stuck. Some of them (such as NFS connections) will be unkillable
@@ -220,11 +213,6 @@ case "$1" in
      ##################################################
      # called when ctdbd wants to update an IP address
      updateip)
-       if [ $# != 5 ]; then
-          echo "ERROR: must supply old interface, new interface, IP and maskbits"
-          exit 1
-       fi
-
        # moving an IP is a bit more complex than it seems.
        # First we drop all traffic on the old interface.
        # Then we try to add the ip to the new interface and before
index ff4dbdb8c37c3b162ac75fc721fd2b77ba835127..d8a064493e414cd6a504462f0936e44cb4ae161a 100755 (executable)
@@ -326,6 +326,8 @@ setup_per_ip_routing()
        return $?;
 }
 
+ctdb_check_args "$@"
+
 case "$1" in
      #############################
      # called when ctdbd starts up
@@ -368,10 +370,6 @@ case "$1" in
      ################################################
      # called when ctdbd wants to claim an IP address
      takeip)
-       if [ $# != 4 ]; then
-          echo "must supply interface, IP and maskbits"
-          exit 1
-       fi
        iface=$2
        ip=$3
        maskbits=$4
@@ -410,10 +408,6 @@ case "$1" in
      ################################################
      # called when ctdbd wants to claim an IP address
      updateip)
-       if [ $# != 5 ]; then
-          echo "must supply old interface, new interface, IP and maskbits"
-          exit 1
-       fi
        oiface=$2
        niface=$3
        ip=$4
@@ -455,11 +449,6 @@ case "$1" in
      ##################################################
      # called when ctdbd wants to release an IP address
      releaseip)
-       if [ $# != 4 ]; then
-          echo "must supply interface, IP and maskbits"
-          exit 1
-       fi
-
        iface=$2
        ip=$3
        maskbits=$4