Commit 542a15d6 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

[trac736] last TODO (log message) and removed a few debug statements

parent 79532966
......@@ -481,9 +481,9 @@ ModuleCCSession::checkCommand() {
LOG_ERROR(config_logger, CONFIG_CCSESSION_MSG).arg(re.what());
} catch (const std::exception& stde) {
// No matter what unexpected error happens, we do not want
// to crash because of an incoming event
// TODO: MSG
LOG_ERROR(config_logger, CONFIG_CCSESSION_MSG).arg(stde.what());
// to crash because of an incoming event, so we log the
// exception and continue to run
LOG_ERROR(config_logger, CONFIG_CCSESSION_MSG_INTERNAL).arg(stde.what());
}
if (!isNull(answer)) {
session_.reply(routing, answer);
......
......@@ -34,10 +34,8 @@ ConstElementPtr findListOrMapSubSpec(ConstElementPtr spec_part) {
(spec_part->contains("list_item_spec") ||
spec_part->contains("map_item_spec"))) {
if (spec_part->contains("list_item_spec")) {
std::cout << "[XX] yup, list" << std::endl;
spec_part = spec_part->get("list_item_spec");
} else {
std::cout << "[XX] yup, map" << std::endl;
spec_part = spec_part->get("map_item_spec");
}
}
......@@ -56,7 +54,6 @@ ConstElementPtr findItemInSpecList(ConstElementPtr spec_part,
const std::string& id_full)
{
bool found = false;
std::cout << "[XX] find item in list: " << spec_part->str() << std::endl;
BOOST_FOREACH(ConstElementPtr list_el, spec_part->listValue()) {
if (list_el->getType() == Element::map &&
list_el->contains("item_name") &&
......@@ -101,7 +98,6 @@ find_spec_part(ConstElementPtr spec, const std::string& identifier) {
size_t sep = id.find('/');
while(sep != std::string::npos) {
std::string part = id.substr(0, sep);
std::cout << "[XX] NEXT IS: " << part << std::endl;
if (spec_part->getType() == Element::list) {
spec_part = findItemInSpecList(spec_part, part, identifier);
......@@ -109,7 +105,6 @@ find_spec_part(ConstElementPtr spec, const std::string& identifier) {
isc_throw(DataNotFoundError,
"Not a list of spec items: " + spec_part->str());
}
std::cout << "[XX] FOUND: " << part << std::endl;
id = id.substr(sep + 1);
sep = id.find("/");
......@@ -117,11 +112,9 @@ find_spec_part(ConstElementPtr spec, const std::string& identifier) {
// by the identifier, we want to automatically traverse list
// and map specifications
if (id != "" && id != "/") {
std::cout << "[XX] try sublist " << id << std::endl;
spec_part = findListOrMapSubSpec(spec_part);
}
}
std::cout << "[XX] LAST: " << id << std::endl;
if (id != "" && id != "/") {
if (spec_part->getType() == Element::list) {
spec_part = findItemInSpecList(spec_part, id, identifier);
......@@ -131,6 +124,9 @@ find_spec_part(ConstElementPtr spec, const std::string& identifier) {
spec_part->get("map_item_spec"),
id, identifier);
} else {
// Either we already have the element we are looking
// for, or we are trying to reach something that does
// not exist (i.e. the code does not match the spec)
if (!spec_part->contains("item_name") ||
spec_part->get("item_name")->stringValue() != id) {
isc_throw(DataNotFoundError, "Element above " + id +
......
......@@ -48,3 +48,10 @@ channel. The message does not appear to be a valid command, and is
missing a required element or contains an unknown data format. This
most likely means that another BIND10 module is sending a bad message.
The message itself is ignored by this module.
% CCSESSION_MSG_INTERNAL error handling CC session message: %1
There was an internal problem handling an incoming message on the
command and control channel. An unexpected exception was thrown. This
most likely points to an internal inconsistency in the module code. The
exception message is appended to the log error, and the module will
continue to run, but will not send back an answer.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment