From 63c0a4d56b0746c3816a78c6f821d0abd6ae5323 Mon Sep 17 00:00:00 2001 From: Tomek Mrugalski Date: Thu, 9 Mar 2017 13:40:23 +0100 Subject: [PATCH] [master] fix for CA parser (use bison, not Element::fromJSON) --- src/bin/agent/ca_controller.cc | 7 +++++++ src/bin/agent/ca_controller.h | 7 +++++++ src/bin/agent/tests/ca_process_tests.sh.in | 1 + 3 files changed, 15 insertions(+) diff --git a/src/bin/agent/ca_controller.cc b/src/bin/agent/ca_controller.cc index a5508abdb7..475072bf66 100644 --- a/src/bin/agent/ca_controller.cc +++ b/src/bin/agent/ca_controller.cc @@ -8,6 +8,7 @@ #include #include +#include using namespace isc::process; @@ -40,6 +41,12 @@ CtrlAgentController::createProcess() { return (new CtrlAgentProcess(getAppName().c_str(), getIOService())); } +isc::data::ConstElementPtr +CtrlAgentController::parseFile(const std::string& name) { + ParserContext parser; + return (parser.parseFile(name, ParserContext::PARSER_AGENT)); +} + CtrlAgentController::CtrlAgentController() : DControllerBase(agent_app_name_, agent_bin_name_) { } diff --git a/src/bin/agent/ca_controller.h b/src/bin/agent/ca_controller.h index f2c65b78e2..1f2f34417a 100644 --- a/src/bin/agent/ca_controller.h +++ b/src/bin/agent/ca_controller.h @@ -40,6 +40,13 @@ public: /// by convention this should match the executable name. static const char* agent_bin_name_; + /// @brief Parses the configuration file using Agent::ParserContext (bison) + /// + /// @param name name of the text file to be parsed + /// @return Element tree structure representing parsed configuration + isc::data::ConstElementPtr + parseFile(const std::string& name); + private: /// @brief Creates an instance of the Control Agent application diff --git a/src/bin/agent/tests/ca_process_tests.sh.in b/src/bin/agent/tests/ca_process_tests.sh.in index 77fe66280b..e4f8902160 100644 --- a/src/bin/agent/tests/ca_process_tests.sh.in +++ b/src/bin/agent/tests/ca_process_tests.sh.in @@ -16,6 +16,7 @@ EXPECTED_VERSION="@PACKAGE_VERSION@" CONFIG="{ \"Control-agent\": { + \"http-host\": \"127.0.0.1\" }, \"Logging\": { -- 2.47.3