ctdb-scripts: Add new function load_script_options()
authorMartin Schwenke <martin@meltin.net>
Mon, 19 Feb 2018 02:13:26 +0000 (13:13 +1100)
committerAmitay Isaacs <amitay@samba.org>
Wed, 28 Mar 2018 00:57:21 +0000 (02:57 +0200)
For now this loads the global CTDB configuration too.  This will
change in the future after things are properly modularised.

This also anticipates a future change where event scripts end with a
".script" suffix.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/config/functions

index 86780001ab642c40fec5e7d08ca0a94c0e3f5f24..8728d99129b6ccf8e2fa9f48715f533a3dfa9fcf 100755 (executable)
@@ -80,6 +80,17 @@ loadconfig() {
        rewrite_ctdb_options
 }
 
+load_script_options ()
+{
+       loadconfig
+
+       _options="${0%.script}.options"
+
+       if [ -r "$_options" ] ; then
+               . "$_options"
+       fi
+}
+
 ##############################################################
 
 die ()