BIND 10 master, updated. daf2b85fc21361544855324799f2d3af777044e4 Changelog for #1715
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Apr 3 08:11:00 UTC 2012
The branch, master has been updated
via daf2b85fc21361544855324799f2d3af777044e4 (commit)
via 098da24dddad497810aa2787f54126488bb1095c (commit)
via 29f876f89516fb0696d85e760bb9cb15e7e398b2 (commit)
via 17ab7fae73ebcf624a0c719b16f45b9f16db1419 (commit)
via 21b1adb387dab476f88c301ec1538fb6be87ea1e (commit)
from 297646b5cd8cee65d80ef74d07cc7a3b4890d555 (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 daf2b85fc21361544855324799f2d3af777044e4
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue Apr 3 10:10:48 2012 +0200
Changelog for #1715
commit 098da24dddad497810aa2787f54126488bb1095c
Merge: 297646b5cd8cee65d80ef74d07cc7a3b4890d555 29f876f89516fb0696d85e760bb9cb15e7e398b2
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue Apr 3 09:50:38 2012 +0200
Merge #1715
Crash of bindctl when the config unset command was invoked. The code of
the command was missing, probably never implemented and obviously never
tested.
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 6 +++-
src/bin/bindctl/tests/bindctl_test.py | 10 ++++++
src/lib/python/isc/config/config_data.py | 10 ++++++
.../python/isc/config/tests/config_data_test.py | 33 +++++++++++++++++++-
4 files changed, 57 insertions(+), 2 deletions(-)
-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index d12812f..47655e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+418. [bug] vorner
+ Fixed crash in bindctl when config unset was called.
+ (Trac #1715, 098da24dddad497810aa2787f54126488bb1095c)
+
417. [bug] jelte
The notify-out code now looks up notify targets in their correct
zones (and no longer just in the zone that the notify is about).
@@ -13,7 +17,7 @@ bind10-devel-20120329 released on March 29, 2012
415. [doc] jinmei, jreed
BIND 10 Guide updated to now describe the in-memory data source
- configurations for b10-auth.
+ configurations for b10-auth.
(Trac #1732, git 434d8db8dfcd23a87b8e798e5702e91f0bbbdcf6)
414. [bug] jinmei
diff --git a/src/bin/bindctl/tests/bindctl_test.py b/src/bin/bindctl/tests/bindctl_test.py
index 31a6bda..1ddb916 100644
--- a/src/bin/bindctl/tests/bindctl_test.py
+++ b/src/bin/bindctl/tests/bindctl_test.py
@@ -365,10 +365,20 @@ class TestConfigCommands(unittest.TestCase):
self.assertEqual((5, MultiConfigData.LOCAL),
self.tool.config_data.get_value("/foo/an_int"))
+ cmd = cmdparse.BindCmdParse("config unset identifier=\"foo/an_int\"")
+ self.tool.apply_config_cmd(cmd)
+
+ self.assertEqual((1, MultiConfigData.DEFAULT),
+ self.tool.config_data.get_value("/foo/an_int"))
+
# this should raise a NotFoundError
cmd = cmdparse.BindCmdParse("config set identifier=\"foo/bar\" value=\"[]\"")
self.assertRaises(isc.cc.data.DataNotFoundError, self.tool.apply_config_cmd, cmd)
+ cmd = cmdparse.BindCmdParse("config unset identifier=\"foo/bar\"")
+ self.assertRaises(isc.cc.data.DataNotFoundError,
+ self.tool.apply_config_cmd, cmd)
+
# this should raise a TypeError
cmd = cmdparse.BindCmdParse("config set identifier=\"foo/an_int\" value=\"[]\"")
self.assertRaises(isc.cc.data.DataTypeError, self.tool.apply_config_cmd, cmd)
diff --git a/src/lib/python/isc/config/config_data.py b/src/lib/python/isc/config/config_data.py
index e7e810b..48d7c1f 100644
--- a/src/lib/python/isc/config/config_data.py
+++ b/src/lib/python/isc/config/config_data.py
@@ -672,6 +672,16 @@ class MultiConfigData:
self._append_value_item(result, spec_part, identifier, all, True)
return result
+ def unset(self, identifier):
+ """
+ Reset the value to default.
+ """
+ spec_part = self.find_spec_part(identifier)
+ if spec_part is not None:
+ isc.cc.data.unset(self._local_changes, identifier)
+ else:
+ raise isc.cc.data.DataNotFoundError(identifier + "not found")
+
def set_value(self, identifier, value):
"""Set the local value at the given identifier to value. If
there is a specification for the given identifier, the type
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 446d898..97caad8 100644
--- a/src/lib/python/isc/config/tests/config_data_test.py
+++ b/src/lib/python/isc/config/tests/config_data_test.py
@@ -657,7 +657,38 @@ class TestMultiConfigData(unittest.TestCase):
self.assertEqual(MultiConfigData.LOCAL, status)
self.assertRaises(isc.cc.data.DataTypeError, self.mcd.set_value, "Spec2/item5[a]", "asdf")
-
+
+
+ def test_unset(self):
+ """
+ Test the unset command works.
+ """
+ module_spec = isc.config.module_spec_from_file(self.data_path + os.sep + "spec2.spec")
+ self.mcd.set_specification(module_spec)
+ self.mcd.set_specification(module_spec)
+ value, status = self.mcd.get_value("Spec2/item1")
+ # This is the default first
+ self.assertEqual(1, value)
+ self.assertEqual(MultiConfigData.DEFAULT, status)
+ # Unseting a default item does nothing.
+ self.mcd.unset("Spec2/item1")
+ value, status = self.mcd.get_value("Spec2/item1")
+ # This should be the default
+ self.assertEqual(1, value)
+ self.assertEqual(MultiConfigData.DEFAULT, status)
+ # Set it to something else
+ self.mcd.set_value("Spec2/item1", 42)
+ value, status = self.mcd.get_value("Spec2/item1")
+ self.assertEqual(42, value)
+ self.assertEqual(MultiConfigData.LOCAL, status)
+ # Try to unset it
+ self.mcd.unset("Spec2/item1")
+ value, status = self.mcd.get_value("Spec2/item1")
+ # This should be the default
+ self.assertEqual(1, value)
+ self.assertEqual(MultiConfigData.DEFAULT, status)
+ # Unset a nonexisting item. Should raise.
+ self.assertRaises(isc.cc.data.DataNotFoundError, self.mcd.unset, "Spec2/doesnotexist")
def test_get_config_item_list(self):
config_items = self.mcd.get_config_item_list()
More information about the bind10-changes
mailing list