summaryrefslogtreecommitdiff
path: root/ctdb/tests
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2018-04-04 19:06:13 +1000
committerAmitay Isaacs <amitay@samba.org>2018-05-12 06:11:17 +0200
commit02444e5f479f2d9705de93006916d9cd1333f21c (patch)
treeda546a292f8d5fb802a4daa511fc759c8b407a55 /ctdb/tests
parent00f35b7b0d0b341e2ef1c7f699f80bbf0e5dc3e0 (diff)
downloadsamba-02444e5f479f2d9705de93006916d9cd1333f21c.tar.gz
ctdb-scripts: Allow load_script_options() to specify an event script
This allows other scripts to use the given options for a particular event script. One interesting example is that the ctdb_natgw tool should look for configuration in events.d/11.natgw.options. In the future this will be something like events/failover/11.natgw.options, so require the component to be specified even though it isn't yet used. Test support is also updated. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/tests')
-rw-r--r--ctdb/tests/eventscripts/scripts/local.sh19
1 files changed, 16 insertions, 3 deletions
diff --git a/ctdb/tests/eventscripts/scripts/local.sh b/ctdb/tests/eventscripts/scripts/local.sh
index 49c84baa95e..101769bf9e2 100644
--- a/ctdb/tests/eventscripts/scripts/local.sh
+++ b/ctdb/tests/eventscripts/scripts/local.sh
@@ -71,11 +71,24 @@ fi
# General setup fakery
-# The current implementation just assumes each non-comment line of
-# input is a variable assignment and evals it with export prepended.
+# Default is to use script name with ".options" appended. With
+# arguments, this can specify an alternate script name (and
+# component).
setup_script_options ()
{
- _options="${script_dir}/${script%.script}.options"
+ if [ $# -eq 2 ] ; then
+ _script="$2"
+ elif [ $# -eq 0 ] ; then
+ _script=""
+ else
+ die "usage: setup_script_options [ component script ]"
+ fi
+
+ if [ -n "$_script" ] ; then
+ _options="${CTDB_BASE}/events.d/${_script}.options"
+ else
+ _options="${script_dir}/${script%.script}.options"
+ fi
cat >>"$_options"