}
if (module_config->getType() != Element::map) {
isc_throw(InvalidUsage, "Config file " << config_file <<
- " include not map '" << getAppName() << "' entry");
+ " includes not map '" << getAppName() << "' entry");
}
// Handle other (i.e. not application name) objects.
- handleOtherObjects(whole_config);
+ std::string errmsg = handleOtherObjects(whole_config);
+ if (!errmsg.empty()) {
+ isc_throw(InvalidUsage, "Config file " << config_file << errmsg);
+ }
// Get an application process object.
initProcess();
}
if (module_config->getType() != Element::map) {
isc_throw(InvalidUsage, "Config file " << config_file <<
- " include not map '" << getAppName() << "' entry");
+ " includes not map '" << getAppName() << "' entry");
}
// Handle other (i.e. not application name) objects.
- handleOtherObjects(whole_config);
+ std::string errmsg = handleOtherObjects(whole_config);
+ if (!errmsg.empty()) {
+ isc_throw(InvalidUsage, "Config file " << config_file << errmsg);
+ }
// Let's configure logging before applying the configuration,
// so we can log things during configuration process.
+ filename + " successful", params));
}
-void
+std::string
DControllerBase::handleOtherObjects(ConstElementPtr args) {
// Check obsolete or unknown (aka unsupported) objects.
const std::string& app_name = getAppName();
+ std::string errmsg;
for (auto obj : args->mapValue()) {
const std::string& obj_name = obj.first;
if (obj_name == app_name) {
LOG_ERROR(dctl_logger, DCTL_CONFIG_DEPRECATED)
.arg("'" + obj_name + "', defining anything in global level besides '"
+ app_name + "' is no longer supported.");
+ if (errmsg.empty()) {
+ errmsg = " contains unsupported '" + obj_name + "' parameter";
+ } else {
+ errmsg += " (and '" + obj_name + "')";
+ }
}
+ return (errmsg);
}
ConstElementPtr
}
}
+ if (message.empty()) {
+ // Handle other (i.e. not application name) objects.
+ std::string errmsg = handleOtherObjects(args);
+ if (!errmsg.empty()) {
+ message = "'arguments' parameter" + errmsg;
+ }
+ }
+
if (!message.empty()) {
// Something is amiss with arguments, return a failure response.
ConstElementPtr result = isc::config::createAnswer(status_code,
return (result);
}
- // Handle other (i.e. not application name) objects.
- handleOtherObjects(args);
// We are starting the configuration process so we should remove any
// staging configuration that has been created during previous