summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2016-04-26 11:04:36 -0400
committerJakub Hrozek <jhrozek@redhat.com>2016-06-16 13:36:44 +0200
commit131684b9107a3fc07906013d16b35975531f2864 (patch)
tree99a7bd6aedf5f55e521ce66cdfe2d645c50cebf4
parent60787fb44924e84a0c7ddfe9d5e62e64ea1edcd1 (diff)
downloadsssd-131684b9107a3fc07906013d16b35975531f2864.tar.gz
sssd-131684b9107a3fc07906013d16b35975531f2864.tar.xz
sssd-131684b9107a3fc07906013d16b35975531f2864.zip
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 Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Petr Cech <pcech@redhat.com>
-rw-r--r--src/confdb/confdb.h1
-rw-r--r--src/config/SSSDConfig/__init__.py.in1
-rwxr-xr-xsrc/config/SSSDConfigTest.py3
-rw-r--r--src/config/etc/sssd.api.conf2
-rw-r--r--src/man/sssd.conf.5.xml13
-rw-r--r--src/util/server.c15
6 files changed, 34 insertions, 1 deletions
diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h
index 3ed82ca0a..0a3d6a035 100644
--- a/src/confdb/confdb.h
+++ b/src/confdb/confdb.h
@@ -53,6 +53,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/config/SSSDConfig/__init__.py.in b/src/config/SSSDConfig/__init__.py.in
index abbf5dca8..06127584f 100644
--- a/src/config/SSSDConfig/__init__.py.in
+++ b/src/config/SSSDConfig/__init__.py.in
@@ -40,6 +40,7 @@ else:
# TODO: This needs to be made external
option_strings = {
# [service]
+ 'debug' : _('Set the verbosity of the debug logging'),
'debug_level' : _('Set the verbosity of the debug logging'),
'debug_timestamps' : _('Include timestamps in debug logs'),
'debug_microseconds' : _('Include microseconds in timestamps in debug logs'),
diff --git a/src/config/SSSDConfigTest.py b/src/config/SSSDConfigTest.py
index e518c7565..6ec30234e 100755
--- a/src/config/SSSDConfigTest.py
+++ b/src/config/SSSDConfigTest.py
@@ -299,6 +299,7 @@ class SSSDConfigTestSSSDService(unittest.TestCase):
'krb5_rcache_dir',
'user',
'default_domain_suffix',
+ 'debug',
'debug_level',
'debug_timestamps',
'debug_microseconds',
@@ -497,6 +498,7 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
options = domain.list_options()
control_list = [
'description',
+ 'debug',
'debug_level',
'debug_timestamps',
'min_id',
@@ -863,6 +865,7 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
options = domain.list_options()
control_list = [
'description',
+ 'debug',
'debug_level',
'debug_timestamps',
'min_id',
diff --git a/src/config/etc/sssd.api.conf b/src/config/etc/sssd.api.conf
index fef55364d..91146593d 100644
--- a/src/config/etc/sssd.api.conf
+++ b/src/config/etc/sssd.api.conf
@@ -3,6 +3,7 @@
[service]
# Options available to all services
+debug = int, None, false
debug_level = int, None, false
debug_timestamps = bool, None, false
debug_microseconds = bool, None, false
@@ -108,6 +109,7 @@ subdomains_provider = str, None, false
[domain]
# Options available to all domains
description = str, None, false
+debug = int, None, false
debug_level = int, None, false
debug_timestamps = bool, None, false
command = str, None, false
diff --git a/src/man/sssd.conf.5.xml b/src/man/sssd.conf.5.xml
index b82e94156..d5442d0cd 100644
--- a/src/man/sssd.conf.5.xml
+++ b/src/man/sssd.conf.5.xml
@@ -70,6 +70,19 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="include/debug_levels.xml" />
</varlistentry>
<varlistentry>
+ <term>debug (integer)</term>
+ <listitem>
+ <para>
+ SSSD 1.14 and later also includes the
+ <replaceable>debug</replaceable> alias for
+ <replaceable>debug_level</replaceable> as a
+ convenience feature. If both are specified, the
+ value of <replaceable>debug_level</replaceable>
+ will be used.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term>debug_timestamps (bool)</term>
<listitem>
<para>
diff --git a/src/util/server.c b/src/util/server.c
index 67a259557..074dc3484 100644
--- a/src/util/server.c
+++ b/src/util/server.c
@@ -567,7 +567,7 @@ 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) "
@@ -575,6 +575,19 @@ int server_setup(const char *name, int flags,
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);
}