From 7980a4cb44dce3bb69893f5ea366c45462123a43 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Tue, 23 Aug 2011 16:32:34 +1000 Subject: 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 (This used to be ctdb commit 36de7e7fd6dfeed61ef9977b8d5b568f90a9707b) --- ctdb/config/functions | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ctdb/config/functions b/ctdb/config/functions index ce28cdbd4d..e30e57dba0 100755 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -82,6 +82,26 @@ debug () fi } +############################################################## +# 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() { -- cgit