From: Francis Dupont Date: Tue, 16 Jul 2019 14:46:25 +0000 (+0200) Subject: [208-finish-move-logging] Two other cases... X-Git-Tag: Kea-1.6.0-beta2~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a4df04930102487df744e190f9d5cb48da2aeec;p=thirdparty%2Fkea.git [208-finish-move-logging] Two other cases... --- diff --git a/src/lib/process/d_controller.cc b/src/lib/process/d_controller.cc index 735a9181ba..f94504d74f 100644 --- a/src/lib/process/d_controller.cc +++ b/src/lib/process/d_controller.cc @@ -191,28 +191,8 @@ DControllerBase::checkConfigOnly() { " include not map '" << getAppName() << "' entry"); } - // Check obsolete or unknown (aka unsupported) objects. - for (auto obj : whole_config->mapValue()) { - const std::string& app_name = getAppName(); - const std::string& obj_name = obj.first; - if (obj_name == app_name) { - continue; - } - if (obj_name == "Logging") { - LOG_WARN(dctl_logger, DCTL_CONFIG_DEPRECATED) - .arg("'Logging' defined in top level. This is deprecated." - " Please define it in the '" + app_name + "' scope."); - continue; - } - LOG_WARN(dctl_logger, DCTL_CONFIG_DEPRECATED) - .arg("'" + obj_name + "', defining anything in global level besides '" - + app_name + "' is no longer supported."); - } - - // Relocate Logging: if there is a global Logging object takes its - // loggers entry, move the entry to AppName object and remove - // now empty Logging. - Daemon::relocateLogging(whole_config, getAppName()); + // Handle other (i.e. not application name) objects (e.g. Logging). + handleOtherObjects(whole_config); // Get an application process object. initProcess(); @@ -384,28 +364,8 @@ DControllerBase::configFromFile() { " include not map '" << getAppName() << "' entry"); } - // Check obsolete or unknown (aka unsupported) objects. - for (auto obj : whole_config->mapValue()) { - const std::string& app_name = getAppName(); - const std::string& obj_name = obj.first; - if (obj_name == app_name) { - continue; - } - if (obj_name == "Logging") { - LOG_WARN(dctl_logger, DCTL_CONFIG_DEPRECATED) - .arg("Logging defined in top level. This is deprecated." - " Please define it in the '" + app_name + "' scope."); - continue; - } - LOG_WARN(dctl_logger, DCTL_CONFIG_DEPRECATED) - .arg("'" + obj_name + "', defining anything in global level besides '" - + app_name + "' is no longer supported."); - } - - // Relocate Logging: if there is a global Logging object takes its - // loggers entry, move the entry to AppName object and remove - // now empty Logging. - Daemon::relocateLogging(whole_config, getAppName()); + // Handle other (i.e. not application name) objects (e.g. Logging). + handleOtherObjects(whole_config); // Let's configure logging before applying the configuration, // so we can log things during configuration process. @@ -552,12 +512,6 @@ DControllerBase::handleOtherObjects(ConstElementPtr args) { // loggers entry, move the entry to AppName object and remove // now empty Logging. Daemon::relocateLogging(args, app_name); - - // We are starting the configuration process so we should remove any - // staging configuration that has been created during previous - // configuration attempts. - // We're not using cfgmgr to store logging information anymore. - // isc::dhcp::CfgMgr::instance().rollback(); } ConstElementPtr @@ -590,6 +544,12 @@ DControllerBase::configTestHandler(const std::string&, ConstElementPtr args) { // Handle other (i.e. not application name) objects (e.g. Logging). handleOtherObjects(args); + // We are starting the configuration process so we should remove any + // staging configuration that has been created during previous + // configuration attempts. + // 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)); } @@ -632,6 +592,12 @@ DControllerBase::configSetHandler(const std::string&, ConstElementPtr args) { // Handle other (i.e. not application name) objects (e.g. Logging). handleOtherObjects(args); + // We are starting the configuration process so we should remove any + // staging configuration that has been created during previous + // configuration attempts. + // We're not using cfgmgr to store logging information anymore. + // isc::dhcp::CfgMgr::instance().rollback(); + // Temporary storage for logging configuration ConfigPtr storage(new ConfigBase()); diff --git a/src/lib/process/d_controller.h b/src/lib/process/d_controller.h index 8093bcf4ba..339845f591 100644 --- a/src/lib/process/d_controller.h +++ b/src/lib/process/d_controller.h @@ -603,7 +603,7 @@ protected: /// @brief Deals with other (i.e. not application name) global objects. /// - /// Code shared between config-test and config-set command handlers: + /// Code shared between configuration handlers: /// - check obsolete or unknown (aka unsupported) objects. /// - relocate Logging. ///