From: Martin Schwenke Date: Mon, 20 Aug 2018 03:29:52 +0000 (+1000) Subject: ctdb-doc: Handle boolean options in config migration more carefully X-Git-Tag: tdb-1.3.17~2030 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64d4a7ae5ac3aed2b1b9e7ab85c372e6900826ac;p=thirdparty%2Fsamba.git ctdb-doc: Handle boolean options in config migration more carefully Values for ctdb.conf options are now returned by get_ctdb_conf_option(). The main goal is to allow old boolean options to be replaced by new logically negated options. 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 d9d71da39a2..00896577aad 100755 --- a/ctdb/doc/examples/config_migrate.sh +++ b/ctdb/doc/examples/config_migrate.sh @@ -109,33 +109,44 @@ out_file_remove_if_empty () # script # -# Convert a ctdbd.conf opt+val into a ctdb.conf section+opt +# Convert a ctdbd.conf opt+val into a ctdb.conf section+opt+val # # If opt is matched and val is empty then output is printed, allowing # this function to be reused to check if opt is valid. +# +# Note that for boolean options, the expected value and the new value +# form part of the data. get_ctdb_conf_option () { _opt="$1" _val="$2" awk -v opt="${_opt}" -v val="${_val}" \ - '$3 == opt { if (!$4 || !val || val ==$4) { print $1, $2 } }' <