BIND 10 master, updated. d5ade3d32087884e477d8f5b2fa200324b96ea0a [master] update changelog

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Nov 2 08:59:21 UTC 2011


The branch, master has been updated
       via  d5ade3d32087884e477d8f5b2fa200324b96ea0a (commit)
       via  0e776c32330aee466073771600390ce74b959b38 (commit)
       via  1cdc605c50c999ffc1225bee5817aa0ae26bcc4d (commit)
       via  8b5b28cdbd7be0c7a79950b52679ac4be3db274b (commit)
       via  df9b10fae5385c1c0f1cacb2894eee347abe1f09 (commit)
      from  723a57edeb33afe206a8e350cfc583d5cb451051 (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 d5ade3d32087884e477d8f5b2fa200324b96ea0a
Author: Jelte Jansen <jelte at isc.org>
Date:   Wed Nov 2 09:58:46 2011 +0100

    [master] update changelog

commit 0e776c32330aee466073771600390ce74b959b38
Merge: 723a57edeb33afe206a8e350cfc583d5cb451051 1cdc605c50c999ffc1225bee5817aa0ae26bcc4d
Author: Jelte Jansen <jelte at isc.org>
Date:   Wed Nov 2 09:53:16 2011 +0100

    Merge branch 'trac1344'

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

Summary of changes:
 ChangeLog                                          |    7 ++++
 src/lib/config/tests/testdata/spec32.spec          |   21 +++++++++++
 src/lib/python/isc/config/config_data.py           |    8 +++-
 src/lib/python/isc/config/tests/ccsession_test.py  |   38 +++++++++++++++++++-
 .../python/isc/config/tests/config_data_test.py    |    2 +-
 5 files changed, 72 insertions(+), 4 deletions(-)

-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index ede474a..3e40ac3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+310.	[bug]		jelte
+	Fixed a bug where bindctl could not set a value that is optional
+	and has no default, resulting in the error that the setting
+	itself was unknown. bindctl now correctly sees the setting and
+	is able to set it.
+	(Trac #1344, git 0e776c32330aee466073771600390ce74b959b38)
+
 309.	[bug]		jelte
 	Fixed a bug in bindctl where the removal of elements from a set
 	with default values was not stored, unless the set had been
diff --git a/src/lib/config/tests/testdata/spec32.spec b/src/lib/config/tests/testdata/spec32.spec
index 68e774e..0d8cf7c 100644
--- a/src/lib/config/tests/testdata/spec32.spec
+++ b/src/lib/config/tests/testdata/spec32.spec
@@ -12,6 +12,27 @@
           "item_optional": false,
           "item_default": 3
         }
+      },
+      { "item_name": "named_set_item2",
+        "item_type": "named_set",
+        "item_optional": true,
+        "item_default": { },
+        "named_set_item_spec": {
+          "item_name": "named_set_element",
+          "item_type": "map",
+          "item_optional": false,
+          "item_default": {},
+          "map_item_spec": [
+          { "item_name": "first",
+            "item_type": "integer",
+            "item_optional": true
+          },
+          { "item_name": "second",
+            "item_type": "string",
+            "item_optional": true
+          }
+          ]
+        }
       }
     ]
   }
diff --git a/src/lib/python/isc/config/config_data.py b/src/lib/python/isc/config/config_data.py
index fabd37d..b2cf048 100644
--- a/src/lib/python/isc/config/config_data.py
+++ b/src/lib/python/isc/config/config_data.py
@@ -515,7 +515,7 @@ class MultiConfigData:
             return value, self.CURRENT
         if default:
             value = self.get_default_value(identifier)
-            if value != None:
+            if value is not None:
                 return value, self.DEFAULT
         return None, self.NONE
 
@@ -649,7 +649,11 @@ class MultiConfigData:
             id, list_indices = isc.cc.data.split_identifier_list_indices(id_part)
             cur_value, status = self.get_value(cur_id_part + id)
             # Check if the value was there in the first place
-            if status == MultiConfigData.NONE and cur_id_part != "/":
+            # If we are at the final element, we do not care whether we found
+            # it, since if we have reached this point and it did not exist,
+            # it was apparently an optional value without a default.
+            if status == MultiConfigData.NONE and cur_id_part != "/" and\
+               cur_id_part + id != identifier:
                 raise isc.cc.data.DataNotFoundError(id_part +
                                                     " not found in " +
                                                     cur_id_part)
diff --git a/src/lib/python/isc/config/tests/ccsession_test.py b/src/lib/python/isc/config/tests/ccsession_test.py
index 70ac114..8d616e2 100644
--- a/src/lib/python/isc/config/tests/ccsession_test.py
+++ b/src/lib/python/isc/config/tests/ccsession_test.py
@@ -776,14 +776,50 @@ class TestUIModuleCCSession(unittest.TestCase):
         value, status = uccs.get_value("/Spec32/named_set_item")
         self.assertEqual({'b': 2}, value)
 
+        uccs.set_value("/Spec32/named_set_item/c", 5)
+        value, status = uccs.get_value("/Spec32/named_set_item")
+        self.assertEqual({"b": 2, "c": 5}, value)
+
         self.assertRaises(isc.cc.data.DataNotFoundError,
                           uccs.set_value,
-                          "/Spec32/named_set_item/no_such_item",
+                          "/Spec32/named_set_item/no_such_item/a",
                           4)
         self.assertRaises(isc.cc.data.DataNotFoundError,
                           uccs.remove_value, "/Spec32/named_set_item",
                           "no_such_item")
 
+    def test_set_value_named_set(self):
+        fake_conn = fakeUIConn()
+        uccs = self.create_uccs_named_set(fake_conn)
+        value, status = uccs.get_value("/Spec32/named_set_item2")
+        self.assertEqual({}, value)
+        self.assertEqual(status, uccs.DEFAULT)
+
+        # Try setting a value that is optional but has no default
+        uccs.add_value("/Spec32/named_set_item2", "new1")
+        uccs.set_value("/Spec32/named_set_item2/new1/first", 3)
+        # Different method to add a new element
+        uccs.set_value("/Spec32/named_set_item2/new2", { "second": 4 })
+
+        value, status = uccs.get_value("/Spec32/named_set_item2")
+        self.assertEqual({ "new1": {"first": 3 }, "new2": {"second": 4}},
+                         value)
+        self.assertEqual(status, uccs.LOCAL)
+
+        uccs.set_value("/Spec32/named_set_item2/new1/second", "foo")
+
+        value, status = uccs.get_value("/Spec32/named_set_item2")
+        self.assertEqual({ "new1": {"first": 3, "second": "foo" },
+                           "new2": {"second": 4}},
+                         value)
+        self.assertEqual(status, uccs.LOCAL)
+
+        # make sure using a bad name still fails
+        self.assertRaises(isc.cc.data.DataNotFoundError, uccs.set_value,
+                          "/Spec32/named_set_item2/doesnotexist/first", 3)
+
+
+
     def test_commit(self):
         fake_conn = fakeUIConn()
         uccs = self.create_uccs2(fake_conn)
diff --git a/src/lib/python/isc/config/tests/config_data_test.py b/src/lib/python/isc/config/tests/config_data_test.py
index 0dd441d..bede625 100644
--- a/src/lib/python/isc/config/tests/config_data_test.py
+++ b/src/lib/python/isc/config/tests/config_data_test.py
@@ -627,7 +627,7 @@ class TestMultiConfigData(unittest.TestCase):
         config_items = self.mcd.get_config_item_list(None, False)
         self.assertEqual(['Spec32'], config_items)
         config_items = self.mcd.get_config_item_list(None, True)
-        self.assertEqual(['Spec32/named_set_item'], config_items)
+        self.assertEqual(['Spec32/named_set_item', 'Spec32/named_set_item2'], config_items)
         self.mcd.set_value('Spec32/named_set_item', { "aaaa": 4, "aabb": 5, "bbbb": 6})
         config_items = self.mcd.get_config_item_list("/Spec32/named_set_item", True)
         self.assertEqual(['Spec32/named_set_item/aaaa',




More information about the bind10-changes mailing list