From e07b37b105d1f20b8caef24e6790908f938b70af Mon Sep 17 00:00:00 2001 From: Marcin Siodelski Date: Wed, 9 Dec 2020 20:42:56 +0100 Subject: [PATCH] [#432] Addressed review comments - Typo in Changelog, - Moved commentary a few lines up in CA command mgr, - Added a note about relation between processCommand and handleCommand --- ChangeLog | 2 +- src/bin/agent/ca_command_mgr.cc | 7 +++---- src/bin/agent/ca_command_mgr.h | 3 +++ src/lib/config/base_command_mgr.h | 3 +++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b2a59a3414..2907f4e1d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,5 @@ 1844. [bug] marcin - Corrected a bug in Kea Control Agent error responses when + Corrected a bug in Kea Control Agent error responses when a malformed command was sent. In some cases a map with an error response was returned instead of a list. (Gitlab #432) diff --git a/src/bin/agent/ca_command_mgr.cc b/src/bin/agent/ca_command_mgr.cc index db2e80a134..15b0c68a61 100644 --- a/src/bin/agent/ca_command_mgr.cc +++ b/src/bin/agent/ca_command_mgr.cc @@ -48,13 +48,12 @@ isc::data::ConstElementPtr CtrlAgentCommandMgr::processCommand(const isc::data::ConstElementPtr& cmd) { ConstElementPtr answer = HookedCommandMgr::processCommand(cmd); - if (answer->getType() == Element::list) { - return (answer); - } - // Responses from the Kea Control Agent must be always wrapped // in a list because in general they contain responses from // multiple daemons. + if (answer->getType() == Element::list) { + return (answer); + } ElementPtr answer_list = Element::createList(); answer_list->add(boost::const_pointer_cast(answer)); diff --git a/src/bin/agent/ca_command_mgr.h b/src/bin/agent/ca_command_mgr.h index 1995cb5a72..038353b9c4 100644 --- a/src/bin/agent/ca_command_mgr.h +++ b/src/bin/agent/ca_command_mgr.h @@ -51,6 +51,9 @@ public: /// error response must also be wrapped in a list because caller expects /// that CA always returns a list. /// + /// This method is an entry point for dealing with a command. Internally + /// it calls @c CtrlAgentCommandMgr::handleCommand. + /// /// @param cmd Pointer to the data element representing command in JSON /// format. /// @return Pointer to the response. diff --git a/src/lib/config/base_command_mgr.h b/src/lib/config/base_command_mgr.h index 827ca6980f..9cc5a7f987 100644 --- a/src/lib/config/base_command_mgr.h +++ b/src/lib/config/base_command_mgr.h @@ -115,6 +115,9 @@ public: /// This method is virtual so it can be overridden in derived classes to /// pre-process command and post-process response if necessary. /// + /// This method is an entry point for dealing with a command. Internally + /// it calls @c BaseCommandMgr::handleCommand. + /// /// @param cmd Pointer to the data element representing command in JSON /// format. virtual isc::data::ConstElementPtr