#include "common/conf.h"
#include "common/path.h"
+#include "common/logging_conf.h"
+
#include "common/conf_tool.h"
struct conf_tool_context {
}
/* Call functions to initialize config sections/variables */
+ logging_conf_init(ctx->conf, NULL);
if (! conf_valid(ctx->conf)) {
D_ERR("Failed to define configuration options\n");
test_cleanup remove_files
+# Get the default values that are dependent on install prefix
+logging_location=$(ctdb-config get "logging" "location")
+
ok <<EOF
+[logging]
+ # location = ${logging_location}
+ # log level = ERROR
EOF
unit_test ctdb-config dump
--- /dev/null
+#!/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
+ERROR
+EOF
+unit_test ctdb-config get "logging" "log level"
+
+cat > "$conffile" <<EOF
+[logging]
+ location = syslog:magic
+EOF
+
+required_result 22 <<EOF
+conf: validation for option "location" failed
+Failed to load config file $conffile
+EOF
+unit_test ctdb-config validate
+
+cat > "$conffile" <<EOF
+[logging]
+ log level = high
+EOF
+
+required_result 22 <<EOF
+conf: validation for option "log level" failed
+Failed to load config file $conffile
+EOF
+unit_test ctdb-config validate
+
+cat > "$conffile" <<EOF
+[logging]
+ location = syslog
+ log level = notice
+EOF
+
+ok_null
+unit_test ctdb-config validate
+
+ok <<EOF
+syslog
+EOF
+unit_test ctdb-config get "logging" "location"
+
+ok <<EOF
+notice
+EOF
+unit_test ctdb-config get "logging" "log level"
bld.SAMBA_BINARY('ctdb-config',
source='common/conf_tool.c',
cflags='-DCTDB_CONF_TOOL',
- deps='''ctdb-util samba-util talloc replace popt''',
+ deps='''ctdb-logging-conf
+ ctdb-util samba-util talloc replace popt''',
install_path='${CTDB_HELPER_BINDIR}')
bld.SAMBA_BINARY('ctdbd',