summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2011-08-23 16:32:34 +1000
committerMartin Schwenke <martin@meltin.net>2011-08-30 09:33:47 +1000
commit7980a4cb44dce3bb69893f5ea366c45462123a43 (patch)
tree04aa97b61c80fe4ca1a4c2a71f4354bd09202545
parent63729fc35d6995a9685351eabcfaf0ed4076b185 (diff)
downloadsamba-7980a4cb44dce3bb69893f5ea366c45462123a43.tar.gz
samba-7980a4cb44dce3bb69893f5ea366c45462123a43.tar.xz
samba-7980a4cb44dce3bb69893f5ea366c45462123a43.zip
Eventscripts - new function ctdb_check_args()
Pass this "$@" to do common eventscript argument checking. For regular use putting this in 00.ctdb would be enough. However, for developer testing it can be useful to call this in other eventscripts. For example, 10.interfaces and 13.per_ip_routing currently check these by hand. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 36de7e7fd6dfeed61ef9977b8d5b568f90a9707b)
-rwxr-xr-xctdb/config/functions20
1 files changed, 20 insertions, 0 deletions
diff --git a/ctdb/config/functions b/ctdb/config/functions
index ce28cdbd4d..e30e57dba0 100755
--- a/ctdb/config/functions
+++ b/ctdb/config/functions
@@ -83,6 +83,26 @@ debug ()
}
##############################################################
+# check number of args for different events
+ctdb_check_args ()
+{
+ case "$1" in
+ takeip|releaseip)
+ if [ $# != 4 ]; then
+ echo "ERROR: must supply interface, IP and maskbits"
+ exit 1
+ fi
+ ;;
+ updateip)
+ if [ $# != 5 ]; then
+ echo "ERROR: must supply old interface, new interface, IP and maskbits"
+ exit 1
+ fi
+ ;;
+ esac
+}
+
+##############################################################
# determine on what type of system (init style) we are running
detect_init_style() {
# only do detection if not already set: