From: Francis Dupont Date: Wed, 22 May 2019 16:46:31 +0000 (+0200) Subject: [208-move-logging-from-global-objects-to-global-params] Addressed comments X-Git-Tag: Kea-1.6.0-beta~91 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37b8ec6c2c4b64681059f8fad26d112adbb7ee2b;p=thirdparty%2Fkea.git [208-move-logging-from-global-objects-to-global-params] Addressed comments --- diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index 1f34a06a18..9081571139 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc @@ -329,31 +329,18 @@ ControlledDhcpv4Srv::commandConfigSetHandler(const string&, // configuration attempts. CfgMgr::instance().rollback(); - // Check deprecated, obsolete or unknown objects. - set deprecated; - set obsolete; - set unknown; + // Check deprecated, obsolete or unknown (aka unsupported) objects. + list unsupported; for (auto obj : args->mapValue()) { const string& obj_name = obj.first; if ((obj_name == "Dhcp4") || (obj_name == "Logging")) { continue; } - if ((obj_name == "Dhcp6") || (obj_name == "DhcpDdns")) { - // Candidates for deprecated. - continue; - } - if (obj_name == "Control-agent") { - deprecated.insert(obj_name); - continue; - } - if (obj_name == "Netconf") { - obsolete.insert(obj_name); - continue; - } - unknown.insert(obj_name); + unsupported.push_back(obj_name); } - // Relocate Logging. + // Relocate Logging: if there is a global Logging object takes its + // loggers entry, move the entry to Dhcp4 and remove now empty Logging. Daemon::relocateLogging(args, "Dhcp4"); // Parse the logger configuration explicitly into the staging config. @@ -366,45 +353,13 @@ ControlledDhcpv4Srv::commandConfigSetHandler(const string&, // out what exactly is wrong with the new config in case of problems. CfgMgr::instance().getStagingCfg()->applyLoggingCfg(); - // Log deprecated objects. - for (auto name : deprecated) { - LOG_WARN(dhcp4_logger, DHCP4_CONFIG_DEPRECATED_OBJECT).arg(name); - } - - // Log obsolete/unknown objects and return an error. - string bad; - bool bads = false; - for (auto name : obsolete) { - LOG_ERROR(dhcp4_logger, DHCP4_CONFIG_OBSOLETE_OBJECT).arg(name); - if (bad.empty()) { - bad = name; - } else { - bads = true; - } - } - for (auto name : unknown) { - LOG_ERROR(dhcp4_logger, DHCP4_CONFIG_UNKNOWN_OBJECT).arg(name); - if (bad.empty()) { - bad= name; - } else { - bads = true; + // Log unsupported objects. + if (!unsupported.empty()) { + for (auto name : unsupported) { + LOG_ERROR(dhcp4_logger, DHCP4_CONFIG_UNSUPPORTED_OBJECT).arg(name); } - } - if (!obsolete.empty() || !unknown.empty()) { - // Rollback logging. - CfgMgr::instance().getCurrentCfg()->applyLoggingCfg(); - // Return a failure response. - message = "Unsupported object"; - if (bads) { - message += "s"; - } - message = " '" + bad + "'"; - if (bads) { - message += ", ..."; - } - message += " in config"; - return (isc::config::createAnswer(status_code, message)); + // Will return an error in a future version. } // Now we configure the server proper. diff --git a/src/bin/dhcp4/dhcp4_messages.cc b/src/bin/dhcp4/dhcp4_messages.cc index 2454c3adee..9e422bc7ad 100644 --- a/src/bin/dhcp4/dhcp4_messages.cc +++ b/src/bin/dhcp4/dhcp4_messages.cc @@ -1,4 +1,4 @@ -// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Mon Apr 29 2019 17:27 +// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Wed May 22 2019 18:21 #include #include @@ -27,16 +27,14 @@ extern const isc::log::MessageID DHCP4_CLIENT_HOSTNAME_PROCESS = "DHCP4_CLIENT_H extern const isc::log::MessageID DHCP4_CLIENT_NAME_PROC_FAIL = "DHCP4_CLIENT_NAME_PROC_FAIL"; extern const isc::log::MessageID DHCP4_COMMAND_RECEIVED = "DHCP4_COMMAND_RECEIVED"; extern const isc::log::MessageID DHCP4_CONFIG_COMPLETE = "DHCP4_CONFIG_COMPLETE"; -extern const isc::log::MessageID DHCP4_CONFIG_DEPRECATED_OBJECT = "DHCP4_CONFIG_DEPRECATED_OBJECT"; extern const isc::log::MessageID DHCP4_CONFIG_FETCH = "DHCP4_CONFIG_FETCH"; extern const isc::log::MessageID DHCP4_CONFIG_LOAD_FAIL = "DHCP4_CONFIG_LOAD_FAIL"; extern const isc::log::MessageID DHCP4_CONFIG_NEW_SUBNET = "DHCP4_CONFIG_NEW_SUBNET"; -extern const isc::log::MessageID DHCP4_CONFIG_OBSOLETE_OBJECT = "DHCP4_CONFIG_OBSOLETE_OBJECT"; extern const isc::log::MessageID DHCP4_CONFIG_OPTION_DUPLICATE = "DHCP4_CONFIG_OPTION_DUPLICATE"; extern const isc::log::MessageID DHCP4_CONFIG_PACKET_QUEUE = "DHCP4_CONFIG_PACKET_QUEUE"; extern const isc::log::MessageID DHCP4_CONFIG_RECEIVED = "DHCP4_CONFIG_RECEIVED"; extern const isc::log::MessageID DHCP4_CONFIG_START = "DHCP4_CONFIG_START"; -extern const isc::log::MessageID DHCP4_CONFIG_UNKNOWN_OBJECT = "DHCP4_CONFIG_UNKNOWN_OBJECT"; +extern const isc::log::MessageID DHCP4_CONFIG_UNSUPPORTED_OBJECT = "DHCP4_CONFIG_UNSUPPORTED_OBJECT"; extern const isc::log::MessageID DHCP4_CONFIG_UPDATE = "DHCP4_CONFIG_UPDATE"; extern const isc::log::MessageID DHCP4_DB_RECONNECT_ATTEMPT_FAILED = "DHCP4_DB_RECONNECT_ATTEMPT_FAILED"; extern const isc::log::MessageID DHCP4_DB_RECONNECT_ATTEMPT_SCHEDULE = "DHCP4_DB_RECONNECT_ATTEMPT_SCHEDULE"; @@ -164,16 +162,14 @@ const char* values[] = { "DHCP4_CLIENT_NAME_PROC_FAIL", "%1: failed to process the fqdn or hostname sent by a client: %2", "DHCP4_COMMAND_RECEIVED", "received command %1, arguments: %2", "DHCP4_CONFIG_COMPLETE", "DHCPv4 server has completed configuration: %1", - "DHCP4_CONFIG_DEPRECATED_OBJECT", "DHCPv4 server configuration includes a deprecated object: %1", "DHCP4_CONFIG_FETCH", "Fetching configuration data from config backends.", "DHCP4_CONFIG_LOAD_FAIL", "configuration error using file: %1, reason: %2", "DHCP4_CONFIG_NEW_SUBNET", "a new subnet has been added to configuration: %1", - "DHCP4_CONFIG_OBSOLETE_OBJECT", "DHCPv4 server configuration includes an obsolete object: %1", "DHCP4_CONFIG_OPTION_DUPLICATE", "multiple options with the code %1 added to the subnet %2", "DHCP4_CONFIG_PACKET_QUEUE", "DHCPv4 packet queue info after configuration: %1", "DHCP4_CONFIG_RECEIVED", "received configuration %1", "DHCP4_CONFIG_START", "DHCPv4 server is processing the following configuration: %1", - "DHCP4_CONFIG_UNKNOWN_OBJECT", "DHCPv4 server configuration includes an unknown object: %1", + "DHCP4_CONFIG_UNSUPPORTED_OBJECT", "DHCPv4 server configuration includes an unsupported object: %1", "DHCP4_CONFIG_UPDATE", "updated configuration received: %1", "DHCP4_DB_RECONNECT_ATTEMPT_FAILED", "database reconnect failed: %1", "DHCP4_DB_RECONNECT_ATTEMPT_SCHEDULE", "scheduling attempt %1 of %2 in %3 milliseconds", diff --git a/src/bin/dhcp4/dhcp4_messages.h b/src/bin/dhcp4/dhcp4_messages.h index 27b8add691..f1242ce1d1 100644 --- a/src/bin/dhcp4/dhcp4_messages.h +++ b/src/bin/dhcp4/dhcp4_messages.h @@ -1,4 +1,4 @@ -// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Mon Apr 29 2019 17:27 +// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Wed May 22 2019 18:21 #ifndef DHCP4_MESSAGES_H #define DHCP4_MESSAGES_H @@ -28,16 +28,14 @@ extern const isc::log::MessageID DHCP4_CLIENT_HOSTNAME_PROCESS; extern const isc::log::MessageID DHCP4_CLIENT_NAME_PROC_FAIL; extern const isc::log::MessageID DHCP4_COMMAND_RECEIVED; extern const isc::log::MessageID DHCP4_CONFIG_COMPLETE; -extern const isc::log::MessageID DHCP4_CONFIG_DEPRECATED_OBJECT; extern const isc::log::MessageID DHCP4_CONFIG_FETCH; extern const isc::log::MessageID DHCP4_CONFIG_LOAD_FAIL; extern const isc::log::MessageID DHCP4_CONFIG_NEW_SUBNET; -extern const isc::log::MessageID DHCP4_CONFIG_OBSOLETE_OBJECT; extern const isc::log::MessageID DHCP4_CONFIG_OPTION_DUPLICATE; extern const isc::log::MessageID DHCP4_CONFIG_PACKET_QUEUE; extern const isc::log::MessageID DHCP4_CONFIG_RECEIVED; extern const isc::log::MessageID DHCP4_CONFIG_START; -extern const isc::log::MessageID DHCP4_CONFIG_UNKNOWN_OBJECT; +extern const isc::log::MessageID DHCP4_CONFIG_UNSUPPORTED_OBJECT; extern const isc::log::MessageID DHCP4_CONFIG_UPDATE; extern const isc::log::MessageID DHCP4_DB_RECONNECT_ATTEMPT_FAILED; extern const isc::log::MessageID DHCP4_DB_RECONNECT_ATTEMPT_SCHEDULE; diff --git a/src/bin/dhcp4/dhcp4_messages.mes b/src/bin/dhcp4/dhcp4_messages.mes index 5eb3141184..40f1167566 100644 --- a/src/bin/dhcp4/dhcp4_messages.mes +++ b/src/bin/dhcp4/dhcp4_messages.mes @@ -134,10 +134,6 @@ new configuration. It is output during server startup, and when an updated configuration is committed by the administrator. Additional information may be provided. -% DHCP4_CONFIG_DEPRECATED_OBJECT DHCPv4 server configuration includes a deprecated object: %1 -This warning message is issued when the configuration includes a deprecated -object (i.e. a top level element) which will be ignored. - % DHCP4_CONFIG_FETCH Fetching configuration data from config backends. This is an informational message emitted when the DHCPv4 server about to begin retrieving configuration data from one or more configuration backends. @@ -152,10 +148,6 @@ server will continue to use an old configuration. This is an informational message reporting that the configuration has been extended to include the specified IPv4 subnet. -% DHCP4_CONFIG_OBSOLETE_OBJECT DHCPv4 server configuration includes an obsolete object: %1 -This error message is issued when the configuration includes an obsolete -object (i.e. a top level element). - % DHCP4_CONFIG_OPTION_DUPLICATE multiple options with the code %1 added to the subnet %2 This warning message is issued on an attempt to configure multiple options with the same option code for a particular subnet. Adding multiple options @@ -175,8 +167,8 @@ This is a debug message that is issued every time the server receives a configuration. That happens at start up and also when a server configuration change is committed by the administrator. -% DHCP4_CONFIG_UNKNOWN_OBJECT DHCPv4 server configuration includes an unknown object: %1 -This error message is issued when the configuration includes an unknown +% DHCP4_CONFIG_UNSUPPORTED_OBJECT DHCPv4 server configuration includes an unsupported object: %1 +This error message is issued when the configuration includes an unsupported object (i.e. a top level element). % DHCP4_CONFIG_UPDATE updated configuration received: %1 diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc index 0b3a916562..d38ba4433c 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc @@ -331,31 +331,18 @@ ControlledDhcpv6Srv::commandConfigSetHandler(const string&, // configuration attempts. CfgMgr::instance().rollback(); - // Check deprecated, obsolete or unknown objects. - set deprecated; - set obsolete; - set unknown; + // Check deprecated, obsolete or unknown (aka unsupported) objects. + list unsupported; for (auto obj : args->mapValue()) { const string& obj_name = obj.first; if ((obj_name == "Dhcp6") || (obj_name == "Logging")) { continue; } - if ((obj_name == "Dhcp4") || (obj_name == "DhcpDdns")) { - // Candidates for deprecated. - continue; - } - if (obj_name == "Control-agent") { - deprecated.insert(obj_name); - continue; - } - if (obj_name == "Netconf") { - obsolete.insert(obj_name); - continue; - } - unknown.insert(obj_name); + unsupported.push_back(obj_name); } - // Relocate Logging. + // Relocate Logging: if there is a global Logging object takes its + // loggers entry, move the entry to Dhcp6 and remove now empty Logging. Daemon::relocateLogging(args, "Dhcp6"); // Parse the logger configuration explicitly into the staging config. @@ -368,45 +355,13 @@ ControlledDhcpv6Srv::commandConfigSetHandler(const string&, // out what exactly is wrong with the new config in case of problems. CfgMgr::instance().getStagingCfg()->applyLoggingCfg(); - // Log deprecated objects. - for (auto name : deprecated) { - LOG_WARN(dhcp6_logger, DHCP6_CONFIG_DEPRECATED_OBJECT).arg(name); - } - - // Log obsolete/unknown objects and return an error. - string bad; - bool bads = false; - for (auto name : obsolete) { - LOG_ERROR(dhcp6_logger, DHCP6_CONFIG_OBSOLETE_OBJECT).arg(name); - if (bad.empty()) { - bad = name; - } else { - bads = true; - } - } - for (auto name : unknown) { - LOG_ERROR(dhcp6_logger, DHCP6_CONFIG_UNKNOWN_OBJECT).arg(name); - if (bad.empty()) { - bad= name; - } else { - bads = true; + // Log unsupported objects. + if (!unsupported.empty()) { + for (auto name : unsupported) { + LOG_ERROR(dhcp6_logger, DHCP6_CONFIG_UNSUPPORTED_OBJECT).arg(name); } - } - if (!obsolete.empty() || !unknown.empty()) { - // Rollback logging. - CfgMgr::instance().getCurrentCfg()->applyLoggingCfg(); - // Return a failure response. - message = "Unsupported object"; - if (bads) { - message += "s"; - } - message = " '" + bad + "'"; - if (bads) { - message += ", ..."; - } - message += " in config"; - return (isc::config::createAnswer(status_code, message)); + // Will return an error in a future version. } // Now we configure the server proper. diff --git a/src/bin/dhcp6/dhcp6_messages.cc b/src/bin/dhcp6/dhcp6_messages.cc index f9186c97ea..b9c5437da6 100644 --- a/src/bin/dhcp6/dhcp6_messages.cc +++ b/src/bin/dhcp6/dhcp6_messages.cc @@ -1,4 +1,4 @@ -// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Tue Apr 30 2019 10:41 +// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Wed May 22 2019 18:12 #include #include @@ -22,13 +22,11 @@ extern const isc::log::MessageID DHCP6_CLASS_UNDEFINED = "DHCP6_CLASS_UNDEFINED" extern const isc::log::MessageID DHCP6_CLASS_UNTESTABLE = "DHCP6_CLASS_UNTESTABLE"; extern const isc::log::MessageID DHCP6_COMMAND_RECEIVED = "DHCP6_COMMAND_RECEIVED"; extern const isc::log::MessageID DHCP6_CONFIG_COMPLETE = "DHCP6_CONFIG_COMPLETE"; -extern const isc::log::MessageID DHCP6_CONFIG_DEPRECATED_OBJECT = "DHCP6_CONFIG_DEPRECATED_OBJECT"; extern const isc::log::MessageID DHCP6_CONFIG_LOAD_FAIL = "DHCP6_CONFIG_LOAD_FAIL"; -extern const isc::log::MessageID DHCP6_CONFIG_OBSOLETE_OBJECT = "DHCP6_CONFIG_OBSOLETE_OBJECT"; extern const isc::log::MessageID DHCP6_CONFIG_PACKET_QUEUE = "DHCP6_CONFIG_PACKET_QUEUE"; extern const isc::log::MessageID DHCP6_CONFIG_RECEIVED = "DHCP6_CONFIG_RECEIVED"; extern const isc::log::MessageID DHCP6_CONFIG_START = "DHCP6_CONFIG_START"; -extern const isc::log::MessageID DHCP6_CONFIG_UNKNOWN_OBJECT = "DHCP6_CONFIG_UNKNOWN_OBJECT"; +extern const isc::log::MessageID DHCP6_CONFIG_UNSUPPORTED_OBJECT = "DHCP6_CONFIG_UNSUPPORTED_OBJECT"; extern const isc::log::MessageID DHCP6_CONFIG_UPDATE = "DHCP6_CONFIG_UPDATE"; extern const isc::log::MessageID DHCP6_DB_BACKEND_STARTED = "DHCP6_DB_BACKEND_STARTED"; extern const isc::log::MessageID DHCP6_DB_RECONNECT_ATTEMPT_FAILED = "DHCP6_DB_RECONNECT_ATTEMPT_FAILED"; @@ -165,13 +163,11 @@ const char* values[] = { "DHCP6_CLASS_UNTESTABLE", "required class %1 has no test expression", "DHCP6_COMMAND_RECEIVED", "received command %1, arguments: %2", "DHCP6_CONFIG_COMPLETE", "DHCPv6 server has completed configuration: %1", - "DHCP6_CONFIG_DEPRECATED_OBJECT", "DHCPv6 server configuration includes a deprecated object: %1", "DHCP6_CONFIG_LOAD_FAIL", "configuration error using file: %1, reason: %2", - "DHCP6_CONFIG_OBSOLETE_OBJECT", "DHCPv6 server configuration includes an obsolete object: %1", "DHCP6_CONFIG_PACKET_QUEUE", "DHCPv6 packet queue info after configuration: %1", "DHCP6_CONFIG_RECEIVED", "received configuration: %1", "DHCP6_CONFIG_START", "DHCPv6 server is processing the following configuration: %1", - "DHCP6_CONFIG_UNKNOWN_OBJECT", "DHCPv6 server configuration includes an unknown object: %1", + "DHCP6_CONFIG_UNSUPPORTED_OBJECT", "DHCPv6 server configuration includes an unsupported object: %1", "DHCP6_CONFIG_UPDATE", "updated configuration received: %1", "DHCP6_DB_BACKEND_STARTED", "lease database started (type: %1, name: %2)", "DHCP6_DB_RECONNECT_ATTEMPT_FAILED", "database reconnect failed: %1", diff --git a/src/bin/dhcp6/dhcp6_messages.h b/src/bin/dhcp6/dhcp6_messages.h index 7355441701..604a44edc9 100644 --- a/src/bin/dhcp6/dhcp6_messages.h +++ b/src/bin/dhcp6/dhcp6_messages.h @@ -1,4 +1,4 @@ -// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Tue Apr 30 2019 10:41 +// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Wed May 22 2019 18:12 #ifndef DHCP6_MESSAGES_H #define DHCP6_MESSAGES_H @@ -23,13 +23,11 @@ extern const isc::log::MessageID DHCP6_CLASS_UNDEFINED; extern const isc::log::MessageID DHCP6_CLASS_UNTESTABLE; extern const isc::log::MessageID DHCP6_COMMAND_RECEIVED; extern const isc::log::MessageID DHCP6_CONFIG_COMPLETE; -extern const isc::log::MessageID DHCP6_CONFIG_DEPRECATED_OBJECT; extern const isc::log::MessageID DHCP6_CONFIG_LOAD_FAIL; -extern const isc::log::MessageID DHCP6_CONFIG_OBSOLETE_OBJECT; extern const isc::log::MessageID DHCP6_CONFIG_PACKET_QUEUE; extern const isc::log::MessageID DHCP6_CONFIG_RECEIVED; extern const isc::log::MessageID DHCP6_CONFIG_START; -extern const isc::log::MessageID DHCP6_CONFIG_UNKNOWN_OBJECT; +extern const isc::log::MessageID DHCP6_CONFIG_UNSUPPORTED_OBJECT; extern const isc::log::MessageID DHCP6_CONFIG_UPDATE; extern const isc::log::MessageID DHCP6_DB_BACKEND_STARTED; extern const isc::log::MessageID DHCP6_DB_RECONNECT_ATTEMPT_FAILED; diff --git a/src/bin/dhcp6/dhcp6_messages.mes b/src/bin/dhcp6/dhcp6_messages.mes index 47dae75422..d2c202b787 100644 --- a/src/bin/dhcp6/dhcp6_messages.mes +++ b/src/bin/dhcp6/dhcp6_messages.mes @@ -98,20 +98,12 @@ new configuration. it is output during server startup, and when an updated configuration is committed by the administrator. Additional information may be provided. -% DHCP6_CONFIG_DEPRECATED_OBJECT DHCPv6 server configuration includes a deprecated object: %1 -This warning message is issued when the configuration includes a deprecated -object (i.e. a top level element) which will be ignored. - % DHCP6_CONFIG_LOAD_FAIL configuration error using file: %1, reason: %2 This error message indicates that the DHCPv6 configuration has failed. If this is an initial configuration (during server's startup) the server will fail to start. If this is a dynamic reconfiguration attempt the server will continue to use an old configuration. -% DHCP6_CONFIG_OBSOLETE_OBJECT DHCPv6 server configuration includes an obsolete object: %1 -This error message is issued when the configuration includes an obsolete -object (i.e. a top level element). - % DHCP6_CONFIG_PACKET_QUEUE DHCPv6 packet queue info after configuration: %1 This informational message is emitted during DHCPv6 server configuration, immediately after configuring the DHCPv6 packet queue. The information @@ -126,8 +118,8 @@ This is a debug message that is issued every time the server receives a configuration. That happens start up and also when a server configuration change is committed by the administrator. -% DHCP6_CONFIG_UNKNOWN_OBJECT DHCPv6 server configuration includes an unknown object: %1 -This error message is issued when the configuration includes an unknown +% DHCP6_CONFIG_UNSUPPORTED_OBJECT DHCPv6 server configuration includes an unsupported object: %1 +This error message is issued when the configuration includes an unsupported object (i.e. a top level element). % DHCP6_CONFIG_UPDATE updated configuration received: %1 diff --git a/src/bin/dhcp6/dhcp6_parser.yy b/src/bin/dhcp6/dhcp6_parser.yy index 4b2d4b1045..418d898972 100644 --- a/src/bin/dhcp6/dhcp6_parser.yy +++ b/src/bin/dhcp6/dhcp6_parser.yy @@ -476,8 +476,8 @@ global_param: data_directory | server_tag | reservation_mode | calculate_tee_times - | t1_percent - | t2_percent + | t1_percent + | t2_percent | loggers | unknown_map_entry ; @@ -1098,8 +1098,8 @@ subnet6_param: preferred_lifetime | user_context | comment | calculate_tee_times - | t1_percent - | t2_percent + | t1_percent + | t2_percent | unknown_map_entry ; @@ -1220,8 +1220,8 @@ shared_network_param: name | user_context | comment | calculate_tee_times - | t1_percent - | t2_percent + | t1_percent + | t2_percent | unknown_map_entry ; diff --git a/src/lib/process/cb_ctl_base.h b/src/lib/process/cb_ctl_base.h index 223828c1f0..ad7a748e0d 100644 --- a/src/lib/process/cb_ctl_base.h +++ b/src/lib/process/cb_ctl_base.h @@ -324,7 +324,7 @@ protected: /// /// If the collection of audit entries is empty, this method simply /// returns without updating the timestamp. - /// + /// /// @param Reference to the collection of the fetched audit entries. void updateLastAuditEntryTime(const db::AuditEntryCollection& audit_entries) { // Do nothing if there are no audit entries. It is the case if diff --git a/src/lib/process/config_base.cc b/src/lib/process/config_base.cc index 378acd19c1..da835dd4f5 100644 --- a/src/lib/process/config_base.cc +++ b/src/lib/process/config_base.cc @@ -128,11 +128,6 @@ ConfigBase::toElement() const { result->set("server-tag", Element::create(server_tag_.get())); } - // Note this comment below is obsolete... - // We do NOT output ConfigControlInfo here, as it is not a - // top level element, but rather belongs within the process - // element. - return (result); } diff --git a/src/lib/process/d_controller.cc b/src/lib/process/d_controller.cc index 40ed28f557..b20ab3a2bf 100644 --- a/src/lib/process/d_controller.cc +++ b/src/lib/process/d_controller.cc @@ -191,36 +191,27 @@ DControllerBase::checkConfigOnly() { " include not map '" << getAppName() << "' entry"); } - // Check obsolete or unknown objects. - std::set unsupported; + // Check obsolete or unknown (aka unsupported) objects. + std::list unsupported; for (auto obj : whole_config->mapValue()) { const std::string& app_name = getAppName(); const std::string& obj_name = obj.first; if ((obj_name == app_name) || (obj_name == "Logging")) { continue; } - if ((obj_name == "Dhcp4") || (obj_name == "Dhcp6") || - (obj_name == "Control-agent") || (obj_name == "Netconf")) { - if ((app_name == "DhcpDdns") || - (app_name == "Control-agent")) { - continue; - } - if (app_name == "Netconf") { - unsupported.insert(obj_name); - continue; - } - } - unsupported.insert(obj_name); + unsupported.push_back(obj_name); } if (unsupported.size() == 1) { isc_throw(InvalidUsage, "Unsupported object '" - << *unsupported.begin() << "' in config"); + << unsupported.front() << "' in config"); } else if (unsupported.size() > 1) { isc_throw(InvalidUsage, "Unsupported objects '" - << *unsupported.begin() << "', ... in config"); + << unsupported.front() << "', ... in config"); } - // Relocate Logging. + // 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()); // Get an application process object. @@ -393,11 +384,29 @@ DControllerBase::configFromFile() { " include not map '" << getAppName() << "' entry"); } - // Check obsolete objects. - - // Check deprecated objects. + // Check obsolete or unknown (aka unsupported) objects. + std::list unsupported; + for (auto obj : whole_config->mapValue()) { + const std::string& app_name = getAppName(); + const std::string& obj_name = obj.first; + if ((obj_name == app_name) || (obj_name == "Logging")) { + continue; + } + unsupported.push_back(obj_name); + } + if (unsupported.size() == 1) { + isc_throw(InvalidUsage, "Unsupported object '" + << unsupported.front() << "' in config file " + << config_file); + } else if (unsupported.size() > 1) { + isc_throw(InvalidUsage, "Unsupported objects '" + << unsupported.front() << "', ... in config file " + << config_file); + } - // Relocate Logging. + // 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()); // Let's configure logging before applying the configuration, @@ -415,10 +424,6 @@ DControllerBase::configFromFile() { // case of problems. storage->applyLoggingCfg(); - // Log deprecated objects. - - // Log obsolete objects and raise an error. - answer = updateConfig(module_config); // In all cases the right logging configuration is in the context. process_->getCfgMgr()->getContext()->applyLoggingCfg(); diff --git a/src/lib/process/process_messages.cc b/src/lib/process/process_messages.cc index aa4e382ae4..6812f2b097 100644 --- a/src/lib/process/process_messages.cc +++ b/src/lib/process/process_messages.cc @@ -1,4 +1,4 @@ -// File created from ../../../src/lib/process/process_messages.mes on Mon Apr 29 2019 17:28 +// File created from ../../../src/lib/process/process_messages.mes on Wed May 22 2019 18:44 #include #include @@ -19,10 +19,8 @@ extern const isc::log::MessageID DCTL_CONFIG_DEPRECATED = "DCTL_CONFIG_DEPRECATE extern const isc::log::MessageID DCTL_CONFIG_FETCH = "DCTL_CONFIG_FETCH"; extern const isc::log::MessageID DCTL_CONFIG_FILE_LOAD_FAIL = "DCTL_CONFIG_FILE_LOAD_FAIL"; extern const isc::log::MessageID DCTL_CONFIG_LOAD_FAIL = "DCTL_CONFIG_LOAD_FAIL"; -extern const isc::log::MessageID DCTL_CONFIG_OBSOLETE_OBJECT = "DCTL_CONFIG_OBSOLETE_OBJECT"; extern const isc::log::MessageID DCTL_CONFIG_START = "DCTL_CONFIG_START"; extern const isc::log::MessageID DCTL_CONFIG_STUB = "DCTL_CONFIG_STUB"; -extern const isc::log::MessageID DCTL_CONFIG_UNKNOWN_OBJECT = "DCTL_CONFIG_UNKNOWN_OBJECT"; extern const isc::log::MessageID DCTL_CONFIG_UPDATE = "DCTL_CONFIG_UPDATE"; extern const isc::log::MessageID DCTL_INIT_PROCESS = "DCTL_INIT_PROCESS"; extern const isc::log::MessageID DCTL_INIT_PROCESS_FAIL = "DCTL_INIT_PROCESS_FAIL"; @@ -58,10 +56,8 @@ const char* values[] = { "DCTL_CONFIG_FETCH", "Fetching configuration data from config backends.", "DCTL_CONFIG_FILE_LOAD_FAIL", "%1 reason: %2", "DCTL_CONFIG_LOAD_FAIL", "%1 configuration failed to load: %2", - "DCTL_CONFIG_OBSOLETE_OBJECT", "server configuration includes an obsolete object: %1", "DCTL_CONFIG_START", "parsing new configuration: %1", "DCTL_CONFIG_STUB", "%1 configuration stub handler called", - "DCTL_CONFIG_UNKNOWN_OBJECT", "server configuration includes an unknown object: %1", "DCTL_CONFIG_UPDATE", "%1 updated configuration received: %2", "DCTL_INIT_PROCESS", "%1 initializing the application", "DCTL_INIT_PROCESS_FAIL", "%1 application initialization failed: %2", diff --git a/src/lib/process/process_messages.h b/src/lib/process/process_messages.h index 2525423e66..a2f58ef1b1 100644 --- a/src/lib/process/process_messages.h +++ b/src/lib/process/process_messages.h @@ -1,4 +1,4 @@ -// File created from ../../../src/lib/process/process_messages.mes on Mon Apr 29 2019 17:28 +// File created from ../../../src/lib/process/process_messages.mes on Wed May 22 2019 18:44 #ifndef PROCESS_MESSAGES_H #define PROCESS_MESSAGES_H @@ -20,10 +20,8 @@ extern const isc::log::MessageID DCTL_CONFIG_DEPRECATED; extern const isc::log::MessageID DCTL_CONFIG_FETCH; extern const isc::log::MessageID DCTL_CONFIG_FILE_LOAD_FAIL; extern const isc::log::MessageID DCTL_CONFIG_LOAD_FAIL; -extern const isc::log::MessageID DCTL_CONFIG_OBSOLETE_OBJECT; extern const isc::log::MessageID DCTL_CONFIG_START; extern const isc::log::MessageID DCTL_CONFIG_STUB; -extern const isc::log::MessageID DCTL_CONFIG_UNKNOWN_OBJECT; extern const isc::log::MessageID DCTL_CONFIG_UPDATE; extern const isc::log::MessageID DCTL_INIT_PROCESS; extern const isc::log::MessageID DCTL_INIT_PROCESS_FAIL; diff --git a/src/lib/process/process_messages.mes b/src/lib/process/process_messages.mes index 50cbfeca51..fe39c53bb3 100644 --- a/src/lib/process/process_messages.mes +++ b/src/lib/process/process_messages.mes @@ -66,10 +66,6 @@ This critical error message indicates that the initial application configuration has failed. The service will start, but will not process requests until the configuration has been corrected. -% DCTL_CONFIG_OBSOLETE_OBJECT server configuration includes an obsolete object: %1 -This error message is issued when the configuration includes an obsolete -object (i.e. a top level element). - % DCTL_CONFIG_START parsing new configuration: %1 A debug message indicating that the application process has received an updated configuration and has passed it to its configuration manager @@ -79,10 +75,6 @@ for parsing. This debug message is issued when the dummy handler for configuration events is called. This only happens during initial startup. -% DCTL_CONFIG_UNKNOWN_OBJECT server configuration includes an unknown object: %1 -This error message is issued when the configuration includes an unknown -object (i.e. a top level element). - % DCTL_CONFIG_UPDATE %1 updated configuration received: %2 A debug message indicating that the controller has received an updated configuration from the Kea configuration system.