Tests - add hooks to simulate ctdb commands that aren't implemented
authorMartin Schwenke <martin@meltin.net>
Fri, 19 Aug 2011 03:54:20 +0000 (13:54 +1000)
committerMartin Schwenke <martin@meltin.net>
Tue, 30 Aug 2011 06:51:55 +0000 (16:51 +1000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
tests/eventscripts/stubs/ctdb

index ce06a35cbd86c6312714ed7be04bb69c720c294a..4806cc78992d32ecad52c08bb9b6975b92da3e30 100755 (executable)
@@ -2,6 +2,8 @@
 
 prog="ctdb"
 
+not_implemented_exit_code=1
+
 usage ()
 {
     cat >&2 <<EOF
@@ -13,12 +15,10 @@ FAKE_CTDB_PNN (default 0) depending on command-line options.
 Note that -Y is ignored.
 
 EOF
-    exit 1
+    exit $not_implemented_exit_code
 }
 
-# $POSIXLY_CORRECT means that the command passed to onnode can take
-# options and getopt won't reorder things to make them options to this
-# script.
+# Don't set $POSIXLY_CORRECT here.
 _temp=$(getopt -n "$prog" -o "Yvh" -l help -- "$@") || \
     usage
 
@@ -51,6 +51,13 @@ setup_pstore ()
     mkdir -p "$pstore_dir"
 }
 
+# For testing backward compatibility...
+for i in $CTDB_NOT_IMPLEMENTED ; do
+    if [ "$i" = "$1" ] ; then
+       usage
+    fi
+done
+
 case "$1" in
     ip)
        # NOTE: all nodes share the same public addresses file.