From: Martin Schwenke Date: Mon, 20 Aug 2018 09:09:45 +0000 (+1000) Subject: ctdb-doc: Add support for migrating tunables to ctdb.conf options X-Git-Tag: tdb-1.3.17~2027 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ddfc26d79fda2fd0265f370a4c08dc584e6a6ac;p=thirdparty%2Fsamba.git ctdb-doc: Add support for migrating tunables to ctdb.conf options This will become common, so will be useful to have support for. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/doc/examples/config_migrate.sh b/ctdb/doc/examples/config_migrate.sh index db78c486301..9b579302553 100755 --- a/ctdb/doc/examples/config_migrate.sh +++ b/ctdb/doc/examples/config_migrate.sh @@ -160,6 +160,39 @@ check_ctdb_conf_option () [ -n "$_out" ] } +# Convert a ctdbd.conf tunable option into a ctdb.conf section+opt +# +# The difference between this and get_ctdb_conf_option() is that only +# the tunable part of the option is passed as opt and it is matched +# case-insensitively. +get_ctdb_conf_tunable_option () +{ + _opt="$1" + _val="$2" + + awk -v opt="${_opt}" -v val="${_val}" \ + 'tolower($3) == tolower(opt) { + if (!$4 || !val || (val == 0 ? 0 : 1) == $4) { + if ($5) { + print $1, $2, $5 + } else { + print $1, $2, val + } + } + }' <