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

ctdb-tools: Add cluster config options to config tool

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2018-05-11 22:26:16 +10:00 committed by Amitay Isaacs
parent cf17a48d29
commit dbdd49da23
4 changed files with 81 additions and 0 deletions

View File

@ -29,6 +29,7 @@
#include "common/path.h" #include "common/path.h"
#include "common/logging_conf.h" #include "common/logging_conf.h"
#include "cluster/cluster_conf.h"
#include "event/event_conf.h" #include "event/event_conf.h"
#include "common/conf_tool.h" #include "common/conf_tool.h"
@ -237,6 +238,7 @@ int conf_tool_run(struct conf_tool_context *ctx, int *result)
/* Call functions to initialize config sections/variables */ /* Call functions to initialize config sections/variables */
logging_conf_init(ctx->conf, NULL); logging_conf_init(ctx->conf, NULL);
cluster_conf_init(ctx->conf);
event_conf_init(ctx->conf); event_conf_init(ctx->conf);
if (! conf_valid(ctx->conf)) { if (! conf_valid(ctx->conf)) {

View File

@ -22,6 +22,10 @@ ok <<EOF
[logging] [logging]
# location = ${logging_location} # location = ${logging_location}
# log level = ERROR # log level = ERROR
[cluster]
# transport = tcp
# node address =
# recovery lock =
[event] [event]
# debug script = # debug script =
EOF EOF

View File

@ -0,0 +1,74 @@
#!/bin/sh
. "${TEST_SCRIPTS_DIR}/unit.sh"
PATH="$PATH:$CTDB_SCRIPTS_TOOLS_HELPER_DIR"
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
tcp
EOF
unit_test ctdb-config get "cluster" "transport"
ok <<EOF
EOF
unit_test ctdb-config get "cluster" "node address"
ok <<EOF
EOF
unit_test ctdb-config get "cluster" "recovery lock"
cat > "$conffile" <<EOF
[cluster]
transport = invalid
EOF
required_result 22 <<EOF
Invalid value for [cluster] -> transport = invalid
conf: validation for option "transport" failed
Failed to load config file $conffile
EOF
unit_test ctdb-config validate
cat > "$conffile" <<EOF
[cluster]
node address = 10.1.2.3
EOF
ok <<EOF
EOF
unit_test ctdb-config validate
cat > "$conffile" <<EOF
[cluster]
node address = fc00:10:1:2::123
EOF
ok <<EOF
EOF
unit_test ctdb-config validate
cat > "$conffile" <<EOF
[cluster]
node address = 10.1.2.3:123
EOF
required_result 22 <<EOF
Invalid value for [cluster] -> node address = 10.1.2.3:123
conf: validation for option "node address" failed
Failed to load config file $conffile
EOF
unit_test ctdb-config validate

View File

@ -477,6 +477,7 @@ def build(bld):
cflags='-DCTDB_CONF_TOOL', cflags='-DCTDB_CONF_TOOL',
deps='''ctdb-logging-conf deps='''ctdb-logging-conf
ctdb-event-conf ctdb-event-conf
ctdb-cluster-conf
ctdb-util samba-util talloc replace popt''', ctdb-util samba-util talloc replace popt''',
install_path='${CTDB_HELPER_BINDIR}') install_path='${CTDB_HELPER_BINDIR}')