1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

ctdb-tests: Factor out function config_from_environment()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12180

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2016-08-29 16:05:33 +10:00 committed by Amitay Isaacs
parent 9d975b860d
commit a2bbf71ad6

View File

@ -22,6 +22,15 @@ export CTDB_NODES="${TEST_VAR_DIR}/nodes.txt"
#######################################
config_from_environment ()
{
# Override from the environment. This would be easier if env was
# guaranteed to quote its output so it could be reused.
env |
grep '^CTDB_' |
sed -e 's@=\([^"]\)@="\1@' -e 's@[^"]$@&"@' -e 's@="$@&"@'
}
setup_ctdb ()
{
mkdir -p "${TEST_VAR_DIR}/test.db/persistent"
@ -99,11 +108,9 @@ CTDB_SOCKET="${TEST_VAR_DIR}/sock.$pnn"
CTDB_NOSETSCHED=yes
EOF
# Override from the environment. This would be easier if env was
# guaranteed to quote its output so it could be reused.
env |
grep '^CTDB_' |
sed -e 's@=\([^"]\)@="\1@' -e 's@[^"]$@&"@' -e 's@="$@&"@' >>"$conf"
# Append any configuration variables set in environment to
# configuration file so they affect CTDB after each restart.
config_from_environment >>"$conf"
done
}