mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-09-01 22:45:18 +00:00
[208-finish-move-logging] Addressed comment
This commit is contained in:
@@ -528,6 +528,38 @@ DControllerBase::configWriteHandler(const std::string&,
|
|||||||
+ filename + " successful", params));
|
+ filename + " successful", params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DControllerBase::handleOtherObjects(ConstElementPtr args) {
|
||||||
|
// Check obsolete or unknown (aka unsupported) objects.
|
||||||
|
const std::string& app_name = getAppName();
|
||||||
|
for (auto obj : args->mapValue()) {
|
||||||
|
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(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
|
ConstElementPtr
|
||||||
DControllerBase::configTestHandler(const std::string&, ConstElementPtr args) {
|
DControllerBase::configTestHandler(const std::string&, ConstElementPtr args) {
|
||||||
const int status_code = COMMAND_ERROR; // 1 indicates an error
|
const int status_code = COMMAND_ERROR; // 1 indicates an error
|
||||||
@@ -555,33 +587,8 @@ DControllerBase::configTestHandler(const std::string&, ConstElementPtr args) {
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check obsolete or unknown (aka unsupported) objects.
|
// Handle other (i.e. not application name) objects (e.g. Logging).
|
||||||
for (auto obj : args->mapValue()) {
|
handleOtherObjects(args);
|
||||||
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(args, getAppName());
|
|
||||||
|
|
||||||
// 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.
|
// Now we check the server proper.
|
||||||
return (checkConfig(module_config));
|
return (checkConfig(module_config));
|
||||||
@@ -622,33 +629,8 @@ DControllerBase::configSetHandler(const std::string&, ConstElementPtr args) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Check obsolete or unknown (aka unsupported) objects.
|
// Handle other (i.e. not application name) objects (e.g. Logging).
|
||||||
for (auto obj : args->mapValue()) {
|
handleOtherObjects(args);
|
||||||
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(args, getAppName());
|
|
||||||
|
|
||||||
// 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
|
// Temporary storage for logging configuration
|
||||||
ConfigPtr storage(new ConfigBase());
|
ConfigPtr storage(new ConfigBase());
|
||||||
|
@@ -601,6 +601,15 @@ protected:
|
|||||||
/// @return a string containing additional version info
|
/// @return a string containing additional version info
|
||||||
virtual std::string getVersionAddendum() { return (""); }
|
virtual std::string getVersionAddendum() { return (""); }
|
||||||
|
|
||||||
|
/// @brief Deals with other (i.e. not application name) global objects.
|
||||||
|
///
|
||||||
|
/// Code shared between config-test and config-set command handlers:
|
||||||
|
/// - check obsolete or unknown (aka unsupported) objects.
|
||||||
|
/// - relocate Logging.
|
||||||
|
///
|
||||||
|
/// @param args Command arguments.
|
||||||
|
void handleOtherObjects(isc::data::ConstElementPtr args);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// @brief Name of the service under control.
|
/// @brief Name of the service under control.
|
||||||
/// This name is used as the configuration module name and appears in log
|
/// This name is used as the configuration module name and appears in log
|
||||||
|
Reference in New Issue
Block a user