ctdb-common: Log a message for unknown conf option
authorMartin Schwenke <martin@meltin.net>
Thu, 30 Aug 2018 22:32:12 +0000 (08:32 +1000)
committerAmitay Isaacs <amitay@samba.org>
Mon, 3 Sep 2018 08:52:11 +0000 (10:52 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/common/conf.c
ctdb/tests/cunit/conf_test_001.sh
ctdb/tests/cunit/config_test_001.sh

index a6e0f83032849fa01c4375d6d2e02f9d226474b1..cd1fa4acd2bc259353f1f3918cc574f31630a2db 100644 (file)
@@ -1113,8 +1113,14 @@ static bool conf_load_option(const char *name,
        opt = conf_option_find(state->s, name);
        if (opt == NULL) {
                if (state->conf->ignore_unknown) {
+                       D_DEBUG("conf: unknown option [%s] -> \"%s\"\n",
+                               state->s->name,
+                               name);
                        return true;
                } else {
+                       D_ERR("conf: unknown option [%s] -> \"%s\"\n",
+                             state->s->name,
+                             name);
                        state->err = ENOENT;
                        return false;
                }
index 08a51b00d9b30723d14c1754eb87231d1ef11629..a1a84585b1e87e451a10adde8c5dd850b1c54dcb 100755 (executable)
@@ -121,6 +121,7 @@ cat > "$conffile" <<EOF
 EOF
 
 required_result 2 <<EOF
+conf: unknown option [section1] -> "foo"
 [section1]
        # key1 = value1
        # key2 = 10
index d5536bc7f2ae3f804213f4397576697ea437e296..e58f710ac4d5ac20a8f0ba1beb0119b1a0e31992 100755 (executable)
@@ -102,6 +102,7 @@ cat > "$conffile" <<EOF
 EOF
 
 required_result 2 <<EOF
+conf: unknown option [database] -> "unknown key"
 Failed to load config file $conffile
 EOF
 unit_test ctdb-config validate