From 64d4a7ae5ac3aed2b1b9e7ab85c372e6900826ac Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Mon, 20 Aug 2018 13:29:52 +1000 Subject: [PATCH] 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 --- ctdb/doc/examples/config_migrate.sh | 56 ++++++++++++++++------------- 1 file changed, 31 insertions(+), 25 deletions(-) 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 } }' <