ctdb-tools: Add legacy config options to config tool
authorMartin Schwenke <martin@meltin.net>
Fri, 11 May 2018 12:49:46 +0000 (22:49 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 17 May 2018 02:04:31 +0000 (04:04 +0200)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/common/conf_tool.c
ctdb/tests/cunit/config_test_001.sh
ctdb/tests/cunit/config_test_006.sh [new file with mode: 0755]
ctdb/wscript

index 5a8800b049ef69aa03533f59205584bb0a428682..329b20476c11eda2e998307212c620eb2a16c399 100644 (file)
@@ -32,6 +32,7 @@
 #include "cluster/cluster_conf.h"
 #include "database/database_conf.h"
 #include "event/event_conf.h"
+#include "server/legacy_conf.h"
 
 #include "common/conf_tool.h"
 
@@ -242,6 +243,7 @@ int conf_tool_run(struct conf_tool_context *ctx, int *result)
        cluster_conf_init(ctx->conf);
        database_conf_init(ctx->conf);
        event_conf_init(ctx->conf);
+       legacy_conf_init(ctx->conf);
 
        if (! conf_valid(ctx->conf)) {
                D_ERR("Failed to define configuration options\n");
index 3627122baeb1200558cec303e37cb08b54b30239..a3ddaabc09b917bd1ba26a56b6dc6884399343cf 100755 (executable)
@@ -42,6 +42,13 @@ ok <<EOF
        # lock debug script = 
 [event]
        # debug script = 
+[legacy]
+       # no realtime = false
+       # recmaster capability = true
+       # lmaster capability = true
+       # start as stopped = false
+       # start as disabled = false
+       # script log level = ERROR
 EOF
 unit_test ctdb-config dump
 
diff --git a/ctdb/tests/cunit/config_test_006.sh b/ctdb/tests/cunit/config_test_006.sh
new file mode 100755 (executable)
index 0000000..bfbd917
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+. "${TEST_SCRIPTS_DIR}/unit.sh"
+
+PATH="$PATH:$CTDB_SCRIPTS_HELPER_BINDIR"
+
+setup_ctdb_base "${TEST_VAR_DIR}" "cunit"
+
+conffile="${CTDB_BASE}/ctdb.conf"
+
+remove_files ()
+{
+       rm -f "$conffile"
+}
+
+test_cleanup remove_files
+
+cat > "$conffile" <<EOF
+EOF
+
+ok <<EOF
+false
+EOF
+unit_test ctdb-config get "legacy" "no realtime"
+
+ok <<EOF
+true
+EOF
+unit_test ctdb-config get "legacy" "recmaster capability"
+
+ok <<EOF
+true
+EOF
+unit_test ctdb-config get "legacy" "lmaster capability"
+
+ok <<EOF
+false
+EOF
+unit_test ctdb-config get "legacy" "start as stopped"
+
+ok <<EOF
+false
+EOF
+unit_test ctdb-config get "legacy" "start as disabled"
+
+ok <<EOF
+ERROR
+EOF
+unit_test ctdb-config get "legacy" "script log level"
+
+cat > "$conffile" <<EOF
+[legacy]
+       script log level = INVALID
+EOF
+
+required_result 22 <<EOF
+Invalid value for [legacy] -> script log level = INVALID
+conf: validation for option "script log level" failed
+Failed to load config file ${conffile}
+EOF
+unit_test ctdb-config validate
index e29c075e8cca1c9559d8fe21d1c644a24d5e7d1b..7661cba5d200b7af77488cdc5d1629d1407c06d0 100644 (file)
@@ -487,6 +487,7 @@ def build(bld):
                              ctdb-event-conf
                              ctdb-cluster-conf
                              ctdb-database-conf
+                             ctdb-legacy-conf
                              ctdb-util samba-util talloc replace popt''',
                      install_path='${CTDB_HELPER_BINDIR}')