add infrastructure for configuration warnings#492
Conversation
6c7184e to
2072ced
Compare
franku
left a comment
There was a problem hiding this comment.
Very nice!
Have some notes you may want to double-check.
core/src/dird/dird.cc
Outdated
| if (my_config->HaveDeprecationWarnings()) { | ||
| // FIXME: cannot use Jmsg here as only M_FATAL and M_ERROR_TERM will | ||
| // work because daemon_msgs is not initialized | ||
| fprintf(stderr, _("Deprecated configuration settings detected:\n")); |
There was a problem hiding this comment.
When running as a daemon stderr could have been closed.
There was a problem hiding this comment.
if (test_config) gurarantees that we haven't daemonized, because daemon_start() is called in a if (!test_config)-block. And even if daemon_start() had already run stderr would be still open and point to /dev/null (see SetupStdFileDescriptors() in core/src/lib/daemon.cc.
core/src/stored/status.cc
Outdated
| } | ||
| } | ||
|
|
||
| static void sendit(const std::string& msg, StatusPacket* sp) |
There was a problem hiding this comment.
This general function is same for all three daemon. Could move it somewhere into libbareos.
There was a problem hiding this comment.
Point taken. I should probably refactor the whole sendit()-family somewhere into the library.
core/src/dird/dird.cc
Outdated
|
|
||
| if (test_config) { | ||
| if (my_config->HasDeprecationWarnings()) { | ||
| // FIXME: cannot use Jmsg here as only M_FATAL and M_ERROR_TERM will |
There was a problem hiding this comment.
A comment would be helpful anyway to understand why none of the Dmg or Jms can be used.
dd3d947 to
a12729c
Compare
This patch adds a list of warnings to the configuration parser along with some utility functions. The director, storagedaemon and filedaemon in config_test mode will show this list of warnings. When using the status commands, the daemons will report if they have at least one record in that list. The director now has a new command "status configuration" that will currently show only that list of warnings.
a12729c to
c4e88eb
Compare
This PR will add a list of warnings to the configuration parser along with some utility functions. This list can then be filled during (and after) parsing the configuration.
It will also add a few ways to see these deprecation warnings.