eventscripts: Rename some NAT gateway functions
authorMartin Schwenke <martin@meltin.net>
Fri, 7 Mar 2014 02:47:43 +0000 (13:47 +1100)
committerAmitay Isaacs <amitay@gmail.com>
Mon, 31 Mar 2014 02:32:29 +0000 (13:32 +1100)
delete_all() really needed renaming for clarity.  While doing this,
might as well rename some of the others that don't start with
"natgw_".

Signed-off-by: Martin Schwenke <martin@meltin.net>
(Imported from commit 3c839c60d15f11c538709c3e6b85d888131d6e30)

config/events.d/11.natgw

index e5520361b492df6ae55370fb44e504fe8cf16909..852f8f2e29ca699ab46f2cac595b2b780a3d7972 100755 (executable)
@@ -26,7 +26,7 @@ natgw_check_config ()
        die "Invalid configuration: CTDB_NATGW_PRIVATE_NETWORK not set"
 }
 
-set_natgw_capability ()
+natgw_set_capability ()
 {
     # Set NATGW capability depending on configuration
     if [ "$CTDB_NATGW_SLAVE_ONLY" = "yes" ] ; then
@@ -36,7 +36,8 @@ set_natgw_capability ()
     fi
 }
 
-delete_all() {
+natgw_clear ()
+{
        _ip="${CTDB_NATGW_PUBLIC_IP%/*}"
        _maskbits="${CTDB_NATGW_PUBLIC_IP#*/}"
 
@@ -80,7 +81,7 @@ natgw_set_slave ()
     smbcontrol winbindd ip-dropped $CTDB_NATGW_PUBLIC_IP >/dev/null 2>&1
 }
 
-ensure_natgwmaster ()
+natgw_ensure_master ()
 {
     _event="$1"
 
@@ -97,7 +98,7 @@ ensure_natgwmaster ()
 case "$1" in 
     setup)
        natgw_check_config
-       set_natgw_capability
+       natgw_set_capability
        ;;
 
     startup)
@@ -116,10 +117,10 @@ case "$1" in
 
        mypnn=$(ctdb pnn | cut -d: -f2)
 
-       set_natgw_capability
-       ensure_natgwmaster "$1"
+       natgw_set_capability
+       natgw_ensure_master "$1"
 
-       delete_all
+       natgw_clear
 
        if [ "$mypnn" = "$natgwmaster" ]; then
            natgw_set_master
@@ -133,13 +134,13 @@ case "$1" in
 
     shutdown|removenatgw)
        natgw_check_config
-       delete_all
+       natgw_clear
        ;;
 
     monitor)
        natgw_check_config
-       set_natgw_capability
-       ensure_natgwmaster "$1"
+       natgw_set_capability
+       natgw_ensure_master "$1"
        ;;
 
     *)