summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2011-08-30 14:16:28 +1000
committerMartin Schwenke <martin@meltin.net>2011-08-30 16:51:55 +1000
commit1a8d5e0ec7677cbd7a9998ad38565f137cf67770 (patch)
tree8bee733658045a8aaab819194f862f201e3e56d9
parente4ba51effdc7945e2185a9071881dd55734ca262 (diff)
downloadsamba-1a8d5e0ec7677cbd7a9998ad38565f137cf67770.tar.gz
samba-1a8d5e0ec7677cbd7a9998ad38565f137cf67770.tar.xz
samba-1a8d5e0ec7677cbd7a9998ad38565f137cf67770.zip
Tests - eventscripts - add die() function and use it
Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 0446eaa7798fd0ddf8d8f067c56d19892a13a317)
-rw-r--r--ctdb/tests/eventscripts/common.sh19
1 files changed, 8 insertions, 11 deletions
diff --git a/ctdb/tests/eventscripts/common.sh b/ctdb/tests/eventscripts/common.sh
index 235cdaf886..070aa45a05 100644
--- a/ctdb/tests/eventscripts/common.sh
+++ b/ctdb/tests/eventscripts/common.sh
@@ -1,5 +1,8 @@
# Hey Emacs, this is a -*- shell-script -*- !!! :-)
+# Print a message and exit.
+die () { echo "$@" >&2 ; exit 1 ; }
+
# Augment PATH with relevant stubs/ directories. We do this by actually
# setting PATH, and also by setting $EVENTSCRIPTS_PATH and then
# prepending that to $PATH in rc.local to avoid the PATH reset in
@@ -30,8 +33,7 @@ if [ -d "${EVENTSCRIPTS_TESTCASE_DIR}/etc" ] ; then
elif [ -d "${EVENTSCRIPTS_TESTS_DIR}/etc" ] ; then
CTDB_ETCDIR="${EVENTSCRIPTS_TESTS_DIR}/etc"
else
- echo "Unable to set \$CTDB_ETCDIR" >&2
- exit 1
+ die "Unable to set \$CTDB_ETCDIR"
fi
export CTDB_ETCDIR
@@ -42,8 +44,7 @@ elif [ -d "${EVENTSCRIPTS_TESTCASE_DIR}/etc/ctdb" ] ; then
elif [ -d "${EVENTSCRIPTS_TESTS_DIR}/etc-ctdb" ] ; then
CTDB_BASE="${EVENTSCRIPTS_TESTS_DIR}/etc-ctdb"
else
- echo "Unable to set \$CTDB_BASE" >&2
- exit 1
+ die "Unable to set \$CTDB_BASE"
fi
export CTDB_BASE
@@ -426,9 +427,7 @@ rpc_services_up ()
rquotad) _t="1:2" ;;
nlockmgr) _t="3:4" ;;
status) _t="1:1" ;;
- *)
- echo "Internal error - unsupported RPC service \"${_i}\""
- exit 1
+ *) die "Internal error - unsupported RPC service \"${_i}\"" ;;
esac
FAKE_RPCINFO_SERVICES="${FAKE_RPCINFO_SERVICES}${FAKE_RPCINFO_SERVICES:+ }${_i}:${_t}"
@@ -556,8 +555,7 @@ Starting nfslock: OK"
setup_vsftpd ()
{
if [ "$1" != "down" ] ; then
- echo "setup_vsftpd up not implemented!!!"
- exit 1
+ die "setup_vsftpd up not implemented!!!"
else
debug "Setting up VSFTPD environment: service down, not managed by CTDB"
@@ -576,8 +574,7 @@ setup_vsftpd ()
setup_httpd ()
{
if [ "$1" != "down" ] ; then
- echo "setup_httpd up not implemented!!!"
- exit 1
+ die "setup_httpd up not implemented!!!"
else
debug "Setting up HTTPD environment: service down, not managed by CTDB"