BIND 10 master, updated. 137e70ef17439961ac3ce8fa288675502cd26178 Merge branch 'work/badconf'
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue May 31 13:53:13 UTC 2011
The branch, master has been updated
via 137e70ef17439961ac3ce8fa288675502cd26178 (commit)
via a9a606dd7a35d81932f970e00cdf38b466eee2d4 (commit)
via e848d7f24f16319fa07ded7a76af27187a8348ee (commit)
via 95f7b6ea18efc84f160053bec169ab8a736cbb1a (commit)
from db21e8ab55f132828542f1a34642d98bbaf6d8ee (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 137e70ef17439961ac3ce8fa288675502cd26178
Merge: db21e8ab55f132828542f1a34642d98bbaf6d8ee a9a606dd7a35d81932f970e00cdf38b466eee2d4
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue May 31 15:42:28 2011 +0200
Merge branch 'work/badconf'
commit a9a606dd7a35d81932f970e00cdf38b466eee2d4
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue May 31 15:41:59 2011 +0200
[trac472] Remove unnecessary duplicate line
commit e848d7f24f16319fa07ded7a76af27187a8348ee
Author: Jelte Jansen <jelte at isc.org>
Date: Tue May 31 14:51:41 2011 +0200
[trac472] two additional small fixes
commit 95f7b6ea18efc84f160053bec169ab8a736cbb1a
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Tue May 31 13:40:36 2011 +0200
[trac472] Throw when the initial config is bad
For one, because we can, it's synchronous call, for second, ignoring
error is bad no matter what, for third, this makes us use default config
if it's bad, which is potentially even worse. Killing the app is safe.
-----------------------------------------------------------------------
Summary of changes:
src/lib/python/isc/config/ccsession.py | 16 ++++++++++---
src/lib/python/isc/config/module_spec.py | 4 +-
src/lib/python/isc/config/tests/ccsession_test.py | 25 +++++++++++++++++++++
3 files changed, 39 insertions(+), 6 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/config/ccsession.py b/src/lib/python/isc/config/ccsession.py
index 226c6ba..84809f1 100644
--- a/src/lib/python/isc/config/ccsession.py
+++ b/src/lib/python/isc/config/ccsession.py
@@ -329,10 +329,18 @@ class ModuleCCSession(ConfigData):
if answer:
rcode, value = parse_answer(answer)
if rcode == 0:
- if value != None and self.get_module_spec().validate_config(False, value):
- self.set_local_config(value);
- if self._config_handler:
- self._config_handler(value)
+ errors = []
+ if value != None:
+ if self.get_module_spec().validate_config(False,
+ value,
+ errors):
+ self.set_local_config(value);
+ if self._config_handler:
+ self._config_handler(value)
+ else:
+ raise ModuleCCSessionError(
+ "Wrong data in configuration: " +
+ " ".join(errors))
else:
# log error
print("[" + self._module_name + "] Error requesting configuration: " + value)
diff --git a/src/lib/python/isc/config/module_spec.py b/src/lib/python/isc/config/module_spec.py
index 6c90677..6171149 100644
--- a/src/lib/python/isc/config/module_spec.py
+++ b/src/lib/python/isc/config/module_spec.py
@@ -87,7 +87,7 @@ class ModuleSpec:
validate only a part of a configuration tree (like a list of
non-default values)"""
data_def = self.get_config_spec()
- if data_def:
+ if data_def is not None:
return _validate_spec_list(data_def, full, data, errors)
else:
# no spec, always bad
@@ -345,7 +345,7 @@ def _validate_spec_list(module_spec, full, data, errors):
for spec_item in module_spec:
if spec_item["item_name"] == item_name:
found = True
- if not found:
+ if not found and item_name != "version":
if errors != None:
errors.append("unknown item " + item_name)
validated = False
diff --git a/src/lib/python/isc/config/tests/ccsession_test.py b/src/lib/python/isc/config/tests/ccsession_test.py
index 4edc559..a0cafd6 100644
--- a/src/lib/python/isc/config/tests/ccsession_test.py
+++ b/src/lib/python/isc/config/tests/ccsession_test.py
@@ -220,6 +220,31 @@ class TestModuleCCSession(unittest.TestCase):
self.assertEqual({'command': ['get_config', {'module_name': 'Spec2'}]},
fake_session.get_message('ConfigManager', None))
+ def test_start5(self):
+ fake_session = FakeModuleCCSession()
+ mccs = self.create_session("spec2.spec", None, None, fake_session)
+ mccs.set_config_handler(self.my_config_handler_ok)
+ self.assertEqual(len(fake_session.message_queue), 0)
+ fake_session.group_sendmsg(None, 'Spec2')
+ fake_session.group_sendmsg(None, 'Spec2')
+ self.assertRaises(ModuleCCSessionError, mccs.start)
+ self.assertEqual(len(fake_session.message_queue), 2)
+ self.assertEqual({'command': ['module_spec', mccs.specification._module_spec]},
+ fake_session.get_message('ConfigManager', None))
+ self.assertEqual({'command': ['get_config', {'module_name': 'Spec2'}]},
+ fake_session.get_message('ConfigManager', None))
+
+ self.assertEqual(len(fake_session.message_queue), 0)
+ fake_session.group_sendmsg({'result': [ 0 ]}, "Spec2")
+ fake_session.group_sendmsg({'result': [ 0, {"Wrong": True} ]}, "Spec2")
+ self.assertRaises(ModuleCCSessionError, mccs.start)
+ self.assertEqual(len(fake_session.message_queue), 2)
+
+ self.assertEqual({'command': ['module_spec', mccs.specification._module_spec]},
+ fake_session.get_message('ConfigManager', None))
+ self.assertEqual({'command': ['get_config', {'module_name': 'Spec2'}]},
+ fake_session.get_message('ConfigManager', None))
+
def test_get_socket(self):
fake_session = FakeModuleCCSession()
mccs = self.create_session("spec1.spec", None, None, fake_session)
More information about the bind10-changes
mailing list