Parcourir la source

[master] fix for CA parser (use bison, not Element::fromJSON)

Tomek Mrugalski il y a 8 ans
Parent
commit
63c0a4d56b

+ 7 - 0
src/bin/agent/ca_controller.cc

@@ -8,6 +8,7 @@
 
 
 #include <agent/ca_controller.h>
 #include <agent/ca_controller.h>
 #include <agent/ca_process.h>
 #include <agent/ca_process.h>
+#include <agent/parser_context.h>
 
 
 using namespace isc::process;
 using namespace isc::process;
 
 
@@ -40,6 +41,12 @@ CtrlAgentController::createProcess() {
     return (new CtrlAgentProcess(getAppName().c_str(), getIOService()));
     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()
 CtrlAgentController::CtrlAgentController()
     : DControllerBase(agent_app_name_, agent_bin_name_) {
     : DControllerBase(agent_app_name_, agent_bin_name_) {
 }
 }

+ 7 - 0
src/bin/agent/ca_controller.h

@@ -40,6 +40,13 @@ public:
     /// by convention this should match the executable name.
     /// by convention this should match the executable name.
     static const char* agent_bin_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:
 private:
 
 
     /// @brief Creates an instance of the Control Agent application
     /// @brief Creates an instance of the Control Agent application

+ 1 - 0
src/bin/agent/tests/ca_process_tests.sh.in

@@ -16,6 +16,7 @@ EXPECTED_VERSION="@PACKAGE_VERSION@"
 CONFIG="{
 CONFIG="{
     \"Control-agent\":
     \"Control-agent\":
     {
     {
+        \"http-host\": \"127.0.0.1\"
     },
     },
     \"Logging\":
     \"Logging\":
     {
     {