mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +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:
parent
cf17a48d29
commit
dbdd49da23
@ -29,6 +29,7 @@
|
||||
#include "common/path.h"
|
||||
|
||||
#include "common/logging_conf.h"
|
||||
#include "cluster/cluster_conf.h"
|
||||
#include "event/event_conf.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 */
|
||||
logging_conf_init(ctx->conf, NULL);
|
||||
cluster_conf_init(ctx->conf);
|
||||
event_conf_init(ctx->conf);
|
||||
|
||||
if (! conf_valid(ctx->conf)) {
|
||||
|
@ -22,6 +22,10 @@ ok <<EOF
|
||||
[logging]
|
||||
# location = ${logging_location}
|
||||
# log level = ERROR
|
||||
[cluster]
|
||||
# transport = tcp
|
||||
# node address =
|
||||
# recovery lock =
|
||||
[event]
|
||||
# debug script =
|
||||
EOF
|
||||
|
74
ctdb/tests/cunit/config_test_004.sh
Executable file
74
ctdb/tests/cunit/config_test_004.sh
Executable 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
|
@ -477,6 +477,7 @@ def build(bld):
|
||||
cflags='-DCTDB_CONF_TOOL',
|
||||
deps='''ctdb-logging-conf
|
||||
ctdb-event-conf
|
||||
ctdb-cluster-conf
|
||||
ctdb-util samba-util talloc replace popt''',
|
||||
install_path='${CTDB_HELPER_BINDIR}')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user