mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-01 13:23:01 +02:00
confd: fix debug mode regression
In the last major refactor of confd to a stand-alone daemon, new command line options were added, one of which -v <LEVEL>. Unfortunately opening up for a few corner cases where the debug flag or the log_level was not set properly. This fixes that and also adds a CONFD_ARGS for /etc/default/confd, which is customary for all daemons. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -1 +1,5 @@
|
||||
CONFD_TIMEOUT=60
|
||||
#DEBUG=1
|
||||
|
||||
# -v debug
|
||||
CONFD_ARGS=""
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#set DEBUG=1
|
||||
|
||||
# Single daemon handles gen-config, datastore init, config load, and plugins
|
||||
# log:prio:daemon.err
|
||||
service log:console env:/etc/default/confd \
|
||||
service log:console env:/etc/default/confd \
|
||||
[S12345] <usr/ixinit> confd -f -v warning \
|
||||
-F /etc/factory-config.cfg \
|
||||
-S /cfg/startup-config.cfg \
|
||||
-E /etc/failure-config.cfg \
|
||||
-t $CONFD_TIMEOUT \
|
||||
-F /etc/factory-config.cfg \
|
||||
-S /cfg/startup-config.cfg \
|
||||
-E /etc/failure-config.cfg \
|
||||
-t $CONFD_TIMEOUT \
|
||||
$CONFD_ARGS \
|
||||
-- Configuration daemon
|
||||
|
||||
@@ -656,9 +656,10 @@ int main(int argc, char **argv)
|
||||
log_level = LOG_WARNING;
|
||||
else if (!strcmp(optarg, "info"))
|
||||
log_level = LOG_NOTICE;
|
||||
else if (!strcmp(optarg, "debug"))
|
||||
else if (!strcmp(optarg, "debug")) {
|
||||
log_level = LOG_DEBUG;
|
||||
else {
|
||||
debug = 1;
|
||||
} else {
|
||||
fprintf(stderr, "confd error: Invalid verbosity \"%s\"\n", optarg);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -696,6 +697,7 @@ int main(int argc, char **argv)
|
||||
|
||||
if (getenv("DEBUG")) {
|
||||
log_opts |= LOG_PERROR;
|
||||
log_level = LOG_DEBUG;
|
||||
debug = 1;
|
||||
}
|
||||
openlog("confd", log_opts, LOG_DAEMON);
|
||||
|
||||
Reference in New Issue
Block a user