summaryrefslogtreecommitdiffstats
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2015-02-16 14:04:09 +1100
committerAmitay Isaacs <amitay@samba.org>2015-02-18 05:34:06 +0100
commit39686f45056d942de5ebe3263a533a99ca17c79e (patch)
tree5c4ec9f7259c2b81d870fc4b823512572934fd83 /ctdb
parent664d62b61108657d3011cf0bcbe260533c97676f (diff)
downloadsamba-39686f45056d942de5ebe3263a533a99ca17c79e.tar.gz
samba-39686f45056d942de5ebe3263a533a99ca17c79e.tar.xz
samba-39686f45056d942de5ebe3263a533a99ca17c79e.zip
ctdb-scripts: Fix tunable setup code by making it shell-agnostic
All tunables set in configuration are currently set to 0 on system where /bin/sh is dash (and perhaps other non-bash shells). dash puts single quotes around all values in the output of the "set" builtin command, whereas bash only puts them around values when something needs to be quoted. Tunables always have a simple integer value so dash will quote them and bash won't. The setup code currently passes the raw value, including any quotes to "ctdb setvar ...". This command does no error checking on the input, so "'1'" is converted to 0. Change the code so that the value is determined from the shell variable and is independent of the "set" output. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rwxr-xr-xctdb/config/events.d/00.ctdb6
1 files changed, 3 insertions, 3 deletions
diff --git a/ctdb/config/events.d/00.ctdb b/ctdb/config/events.d/00.ctdb
index a0f4102ed9..c3754ae4a9 100755
--- a/ctdb/config/events.d/00.ctdb
+++ b/ctdb/config/events.d/00.ctdb
@@ -121,10 +121,10 @@ update_config_from_tdb() {
set_ctdb_variables () {
# set any tunables from the config file
- set | grep ^CTDB_SET_ | cut -d_ -f3- |
+ set | sed -n '/^CTDB_SET_/s/=.*//p' |
while read v; do
- varname=`echo $v | cut -d= -f1`
- value=`echo $v | cut -d= -f2`
+ varname="${v#CTDB_SET_}"
+ value=$(eval echo "\$$v")
ctdb setvar $varname $value || return 1
echo "Set $varname to $value"
done