On 04/27/2016 08:47 AM, Petr Cech wrote:
On 04/26/2016 05:08 PM, Stephen Gallagher wrote:
Our users constantly make the mistake of typing `debug = 9` in the
sssd.conf
instead of `debug_level = 9` as would be correct. This happens
frequently-enough
that we should just alias it rather than continue to have people make
mistakes.

Resolves:
https://fedorahosted.org/sssd/ticket/2999

Hello Stephen,

thank you for your patch.
I see little disruption of our coding style. My comments are inlined.

Hi Stephen,

I took the liberty and I fixed the nitpicks. Are you alright with attached patch?

[...]

The patch looks good to me. So, I will final ACK after:
* CI (hash 0b9529e)

CI passed
http://sssd-ci.duckdns.org/logs/job/42/74/summary.html

ACKed by me.

Regards

--
Petr^4 Čech
>From e67b7710ca5917cc3846d1bfea76a80cd97df785 Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgall...@redhat.com>
Date: Tue, 26 Apr 2016 11:04:36 -0400
Subject: [PATCH] DEBUG: Add `debug` alias for debug_level

Our users constantly make the mistake of typing `debug = 9` in the
sssd.conf instead of `debug_level = 9` as would be correct. This
happens frequently-enough that we should just alias it rather than
continue to have people make mistakes.

Resolves:
https://fedorahosted.org/sssd/ticket/2999
---
 src/confdb/confdb.h |  1 +
 src/util/server.c   | 16 ++++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h
index c478ef0978b2d1ce302a86a3d536f0447c27fefa..639273c4f8e0f39f8d0a2bb42e31359e5dee1c00 100644
--- a/src/confdb/confdb.h
+++ b/src/confdb/confdb.h
@@ -52,6 +52,7 @@
 #define CONFDB_SERVICE_PATH_TMPL "config/%s"
 #define CONFDB_SERVICE_COMMAND "command"
 #define CONFDB_SERVICE_DEBUG_LEVEL "debug_level"
+#define CONFDB_SERVICE_DEBUG_LEVEL_ALIAS "debug"
 #define CONFDB_SERVICE_DEBUG_TIMESTAMPS "debug_timestamps"
 #define CONFDB_SERVICE_DEBUG_MICROSECONDS "debug_microseconds"
 #define CONFDB_SERVICE_DEBUG_TO_FILES "debug_to_files"
diff --git a/src/util/server.c b/src/util/server.c
index 67a25955783c30dc03f3d6d9193c8547c625f134..67282640f9e06bf1a14d0a359d635809338c8a9a 100644
--- a/src/util/server.c
+++ b/src/util/server.c
@@ -567,14 +567,26 @@ int server_setup(const char *name, int flags,
         /* set debug level if any in conf_entry */
         ret = confdb_get_int(ctx->confdb_ctx, conf_entry,
                              CONFDB_SERVICE_DEBUG_LEVEL,
-                             SSSDBG_DEFAULT,
+                             SSSDBG_UNRESOLVED,
                              &debug_level);
         if (ret != EOK) {
             DEBUG(SSSDBG_FATAL_FAILURE, "Error reading from confdb (%d) "
-                                         "[%s]\n", ret, strerror(ret));
+                                        "[%s]\n", ret, strerror(ret));
             return ret;
         }
 
+        if (debug_level == SSSDBG_UNRESOLVED) {
+            /* Check for the `debug` alias */
+            ret = confdb_get_int(ctx->confdb_ctx, conf_entry,
+                                 CONFDB_SERVICE_DEBUG_LEVEL_ALIAS,
+                                 SSSDBG_DEFAULT, &debug_level);
+            if (ret != EOK) {
+                DEBUG(SSSDBG_FATAL_FAILURE, "Error reading from confdb (%d) "
+                                            "[%s]\n", ret, strerror(ret));
+                return ret;
+            }
+        }
+
         debug_level = debug_convert_old_level(debug_level);
     }
 
-- 
2.5.5

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/sssd-devel@lists.fedorahosted.org

Reply via email to