#include <config.h>
#include <cc/command_interpreter.h>
#include <cfgrpt/config_report.h>
-#include <dhcpsrv/cfgmgr.h>
#include <exceptions/exceptions.h>
#include <log/logger.h>
#include <log/logger_support.h>
+#include <process/daemon.h>
#include <process/d_log.h>
#include <process/d_controller.h>
+#include <process/config_base.h>
#ifdef HAVE_MYSQL
#include <dhcpsrv/mysql_lease_mgr.h>
// It is important that we set a default logger name because this name
// will be used when the user doesn't provide the logging configuration
// in the Kea configuration file.
- isc::dhcp::CfgMgr::instance().setDefaultLoggerName(bin_name_);
+ Daemon::setDefaultLoggerName(bin_name_);
// Logger's default configuration depends on whether we are in the
// verbose mode or not. CfgMgr manages the logger configuration so
// the verbose mode is set for CfgMgr.
- isc::dhcp::CfgMgr::instance().setVerbose(verbose_);
+ Daemon::setVerbose(verbose_);
// Do not initialize logger here if we are running unit tests. It would
// replace an instance of unit test specific logger.
// messages are to be printed.
// This is just a test, so we don't care about lockfile.
setenv("KEA_LOCKFILE_DIR", "none", 0);
- isc::dhcp::CfgMgr::instance().setDefaultLoggerName(bin_name_);
- isc::dhcp::CfgMgr::instance().setVerbose(verbose_);
+ Daemon::setDefaultLoggerName(bin_name_);
+ Daemon::setVerbose(verbose_);
Daemon::loggerInit(bin_name_.c_str(), verbose_);
// Check the syntax first.
DControllerBase::configFromFile() {
// Rollback any previous staging configuration. For D2, only a
// logger configuration is used here.
- isc::dhcp::CfgMgr::instance().rollback();
+ // We're not using cfgmgr to store logging configuration anymore.
+ // isc::dhcp::CfgMgr::instance().rollback();
+
// Will hold configuration.
ConstElementPtr module_config;
// Will receive configuration result.
// so we can log things during configuration process.
// Temporary storage for logging configuration
- isc::dhcp::SrvConfigPtr storage =
- isc::dhcp::CfgMgr::instance().getStagingCfg();
+ ConfigPtr storage = process_->getCfgMgr()->getContext();
// Get 'Logging' element from the config and use it to set up
// logging. If there's no such element, we'll just pass NULL.
if (!rcode) {
// Configuration successful, so apply the logging configuration
// to log4cplus.
- isc::dhcp::CfgMgr::instance().getStagingCfg()->applyLoggingCfg();
- isc::dhcp::CfgMgr::instance().commit();
+ storage->applyLoggingCfg();
}
} catch (const std::exception& ex) {
// Rollback logging configuration.
- isc::dhcp::CfgMgr::instance().rollback();
+ // We don't use CfgMgr to store logging information anymore.
+ // isc::dhcp::CfgMgr::instance().rollback();
+
// build an error result
ConstElementPtr error = createAnswer(COMMAND_ERROR,
std::string("Configuration parsing failed: ") + ex.what());
return (answer);
}
-
void
DControllerBase::runProcess() {
LOG_DEBUG(dctl_logger, isc::log::DBGLVL_START_SHUT, DCTL_RUN_PROCESS)
//
// As a result, we need to extract the CA configuration from one
// place and logging from another.
- ConstElementPtr loginfo = isc::dhcp::CfgMgr::instance().getCurrentCfg()->toElement();
- if (loginfo) {
- // If there was a config stored in dhcp::CfgMgr, try to get Logging info from it.
- loginfo = loginfo->get("Logging");
- }
- if (loginfo) {
- // If there is some logging information, add it to our config.
- cfg->set("Logging", loginfo);
+ if (!cfg->contains("Logging")) {
+ ConfigPtr base_cfg = process_->getCfgMgr()->getContext();
+
+ ConstElementPtr loginfo = base_cfg->toElement();
+ if (loginfo) {
+ // If there was a config stored in dhcp::CfgMgr, try to get Logging info from it.
+ loginfo = loginfo->get("Logging");
+ }
+ if (loginfo) {
+ // If there is some logging information, add it to our config.
+ cfg->set("Logging", loginfo);
+ }
}
try {
// We are starting the configuration process so we should remove any
// staging configuration that has been created during previous
// configuration attempts.
- isc::dhcp::CfgMgr::instance().rollback();
+ // We're not using cfgmgr to store logging information anymore.
+ // isc::dhcp::CfgMgr::instance().rollback();
// Now we check the server proper.
return (checkConfig(module_config));