ctdb-tests: New function setup_script_options()
authorMartin Schwenke <martin@meltin.net>
Thu, 8 Feb 2018 01:18:56 +0000 (12:18 +1100)
committerAmitay Isaacs <amitay@samba.org>
Wed, 28 Mar 2018 00:57:20 +0000 (02:57 +0200)
Currently exports the variable assignment on each line.  Later this
can be changed to handle actual per-script configuration.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tests/eventscripts/scripts/local.sh

index 7823b1f1e5683d5d6ccf7c2304b64cae12ef6f91..782c6d5bb5fa9da11cccfb54ef4bb136a9614e88 100644 (file)
@@ -71,6 +71,18 @@ 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.
+setup_script_options ()
+{
+       while read line ; do
+               case "$line" in
+               \#*|"") : ;;
+               *) eval "export $line"
+               esac
+       done
+}
+
 setup_dbdir ()
 {
        export CTDB_DBDIR="${EVENTSCRIPTS_TESTS_VAR_DIR}/db"