BIND 10 master, updated. 1c54eac8eb70d3fc7c16b83a1269315e710021c1 [master] Update changelog for merge of #2619

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Jan 10 10:49:47 UTC 2013


The branch, master has been updated
       via  1c54eac8eb70d3fc7c16b83a1269315e710021c1 (commit)
       via  bed3c88c25ea8f7e951317775e99ebce3340ca22 (commit)
       via  2d95931bbb2efb3ae30b6fe7219958e40b51c4f8 (commit)
      from  0c40d70c28cda1bc61871cd0e26b74656f45114d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1c54eac8eb70d3fc7c16b83a1269315e710021c1
Author: Jelte Jansen <jelte at isc.org>
Date:   Thu Jan 10 11:11:57 2013 +0100

    [master] Update changelog for merge of #2619

commit bed3c88c25ea8f7e951317775e99ebce3340ca22
Merge: 0c40d70 2d95931
Author: Jelte Jansen <jelte at isc.org>
Date:   Thu Jan 10 11:07:35 2013 +0100

    [master] Merge branch 'trac2619_merge'

commit 2d95931bbb2efb3ae30b6fe7219958e40b51c4f8
Author: Jelte Jansen <jelte at isc.org>
Date:   Wed Jan 9 15:16:07 2013 +0100

    [2619] Make getFullConfig() not 'flatten' the data
    
    Rather, it does a getValue on all top-level elements and puts them in the map to return
    This changes behaviour slightly, but it should reflect the actual use better than the old ones (even in existing cases)

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                     |    7 +++++++
 src/lib/config/config_data.cc                 |    2 +-
 src/lib/config/config_data.h                  |   12 ++++++------
 src/lib/config/tests/config_data_unittests.cc |   11 +++++++----
 4 files changed, 21 insertions(+), 11 deletions(-)

-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index 5f2af46..840da9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+543.	[func]*		jelte
+	When calling getFullConfig() as a module, , the configuration is now
+	returned as properly-structured JSON.  Previously, the structure had
+	been flattened, with all data being labelled by fully-qualified element
+	names.
+	(Trac #2619, git bed3c88c25ea8f7e951317775e99ebce3340ca22)
+
 542.	[func]		marcin
 	Created OptionSpace and OptionSpace6 classes to represent DHCP
 	option spaces. The option spaces are used to group instances
diff --git a/src/lib/config/config_data.cc b/src/lib/config/config_data.cc
index ebe51cc..fb5dd75 100644
--- a/src/lib/config/config_data.cc
+++ b/src/lib/config/config_data.cc
@@ -235,7 +235,7 @@ ConfigData::getItemList(const std::string& identifier, bool recurse) const {
 ConstElementPtr
 ConfigData::getFullConfig() const {
     ElementPtr result = Element::createMap();
-    ConstElementPtr items = getItemList("", true);
+    ConstElementPtr items = getItemList("", false);
     BOOST_FOREACH(ConstElementPtr item, items->listValue()) {
         result->set(item->stringValue(), getValue(item->stringValue()));
     }
diff --git a/src/lib/config/config_data.h b/src/lib/config/config_data.h
index 1be7c7a..e40600d 100644
--- a/src/lib/config/config_data.h
+++ b/src/lib/config/config_data.h
@@ -110,11 +110,11 @@ public:
     isc::data::ConstElementPtr getItemList(const std::string& identifier = "",
                                            bool recurse = false) const;
 
-    /// Returns all current configuration settings (both non-default and default).
+    /// Returns a map of the top-level configuration items, as currently
+    /// set or their defaults
+    ///
     /// \return An ElementPtr pointing to a MapElement containing
-    ///         string->value elements, where the string is the
-    ///         full identifier of the configuration option and the
-    ///         value is an ElementPtr with the value.
+    ///         the top-level configuration items
     isc::data::ConstElementPtr getFullConfig() const;
 
 private:
@@ -126,6 +126,6 @@ private:
 }
 #endif
 
-// Local Variables: 
+// Local Variables:
 // mode: c++
-// End: 
+// End:
diff --git a/src/lib/config/tests/config_data_unittests.cc b/src/lib/config/tests/config_data_unittests.cc
index 26a3fc6..4b83e5c 100644
--- a/src/lib/config/tests/config_data_unittests.cc
+++ b/src/lib/config/tests/config_data_unittests.cc
@@ -118,7 +118,7 @@ TEST(ConfigData, getLocalConfig) {
     ModuleSpec spec2 = moduleSpecFromFile(std::string(TEST_DATA_PATH) + "/spec2.spec");
     ConfigData cd = ConfigData(spec2);
     EXPECT_EQ("{  }", cd.getLocalConfig()->str());
-    
+
     ElementPtr my_config = Element::fromJSON("{ \"item1\": 2 }");
     cd.setLocalConfig(my_config);
     EXPECT_EQ("{ \"item1\": 2 }", cd.getLocalConfig()->str());
@@ -141,12 +141,15 @@ TEST(ConfigData, getFullConfig) {
     ModuleSpec spec2 = moduleSpecFromFile(std::string(TEST_DATA_PATH) + "/spec2.spec");
     ConfigData cd = ConfigData(spec2);
 
-    EXPECT_EQ("{ \"item1\": 1, \"item2\": 1.1, \"item3\": true, \"item4\": \"test\", \"item5\": [ \"a\", \"b\" ], \"item6/value1\": \"default\", \"item6/value2\": None }", cd.getFullConfig()->str());
+    EXPECT_EQ("{ \"item1\": 1, \"item2\": 1.1, \"item3\": true, \"item4\": \"test\", \"item5\": [ \"a\", \"b\" ], \"item6\": {  } }", cd.getFullConfig()->str());
     ElementPtr my_config = Element::fromJSON("{ \"item1\": 2 }");
     cd.setLocalConfig(my_config);
-    EXPECT_EQ("{ \"item1\": 2, \"item2\": 1.1, \"item3\": true, \"item4\": \"test\", \"item5\": [ \"a\", \"b\" ], \"item6/value1\": \"default\", \"item6/value2\": None }", cd.getFullConfig()->str());
+    EXPECT_EQ("{ \"item1\": 2, \"item2\": 1.1, \"item3\": true, \"item4\": \"test\", \"item5\": [ \"a\", \"b\" ], \"item6\": {  } }", cd.getFullConfig()->str());
     ElementPtr my_config2 = Element::fromJSON("{ \"item6\": { \"value1\": \"a\" } }");
     cd.setLocalConfig(my_config2);
-    EXPECT_EQ("{ \"item1\": 1, \"item2\": 1.1, \"item3\": true, \"item4\": \"test\", \"item5\": [ \"a\", \"b\" ], \"item6/value1\": \"a\", \"item6/value2\": None }", cd.getFullConfig()->str());
+    EXPECT_EQ("{ \"item1\": 1, \"item2\": 1.1, \"item3\": true, \"item4\": \"test\", \"item5\": [ \"a\", \"b\" ], \"item6\": { \"value1\": \"a\" } }", cd.getFullConfig()->str());
+    ElementPtr my_config3 = Element::fromJSON("{ \"item6\": { \"value2\": 123 } }");
+    cd.setLocalConfig(my_config3);
+    EXPECT_EQ("{ \"item1\": 1, \"item2\": 1.1, \"item3\": true, \"item4\": \"test\", \"item5\": [ \"a\", \"b\" ], \"item6\": { \"value2\": 123 } }", cd.getFullConfig()->str());
 }
 



More information about the bind10-changes mailing list