BIND 10 trac2113, updated. e93f78639de53b00ae47c3232fedcbded6844d62 [2113] Check the configuration by creating the list
BIND 10 source code commits
bind10-changes at lists.isc.org
Sat Jul 28 12:40:04 UTC 2012
The branch, trac2113 has been updated
via e93f78639de53b00ae47c3232fedcbded6844d62 (commit)
from 22af7691098b53daf64e90313bfd53d5e240d61c (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 e93f78639de53b00ae47c3232fedcbded6844d62
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Sat Jul 28 14:32:56 2012 +0200
[2113] Check the configuration by creating the list
A small bugfix in the validation is included. There's no test for it
directly - it is tested implicitly in the plugin test, but I wasn't able
to reproduce it on small test spec files. If we weren't planning for
replacement of the whole thing, it would need some investigation.
-----------------------------------------------------------------------
Summary of changes:
src/bin/cfgmgr/plugins/datasrc_config_plugin.py | 9 +++++++++
src/bin/cfgmgr/plugins/tests/datasrc_test.py | 22 ++++++++++++++++++++++
src/lib/python/isc/config/module_spec.py | 2 ++
3 files changed, 33 insertions(+)
-----------------------------------------------------------------------
diff --git a/src/bin/cfgmgr/plugins/datasrc_config_plugin.py b/src/bin/cfgmgr/plugins/datasrc_config_plugin.py
index a3f204f..2cd0e7a 100644
--- a/src/bin/cfgmgr/plugins/datasrc_config_plugin.py
+++ b/src/bin/cfgmgr/plugins/datasrc_config_plugin.py
@@ -17,6 +17,8 @@ from isc.config.module_spec import module_spec_from_file
from isc.util.file import path_search
from bind10_config import PLUGIN_PATHS
import isc.dns
+import isc.datasrc
+import json
spec = module_spec_from_file(path_search('datasrc.spec', PLUGIN_PATHS))
def check(config):
@@ -39,6 +41,13 @@ def check(config):
except isc.dns.InvalidRRClass as irc:
return str(irc)
+ dlist = isc.datasrc.ConfigurableClientList(rr_class)
+ try:
+ dlist.configure(json.dumps(classes.get(rr_class_str)),
+ False)
+ except isc.datasrc.Error as dse:
+ return str(dse)
+
return None
def load():
diff --git a/src/bin/cfgmgr/plugins/tests/datasrc_test.py b/src/bin/cfgmgr/plugins/tests/datasrc_test.py
index e703d5d..5d87a16 100644
--- a/src/bin/cfgmgr/plugins/tests/datasrc_test.py
+++ b/src/bin/cfgmgr/plugins/tests/datasrc_test.py
@@ -73,5 +73,27 @@ class DatasrcTest(unittest.TestCase):
for c in ["IN", "CH", "HS"]:
self.accept({c: []})
+ def test_mem_ok(self):
+ """
+ Test we accept an in-memory data source. It doesn't really matter
+ which one it is. We just want to make sure we accept something
+ and this one does not need any kind of path mangling to find
+ plugins.
+ """
+ self.accept({"IN": [{
+ "type": "MasterFiles",
+ "cache-enable": True,
+ "params": {}
+ }]})
+
+ def test_dstype_bad(self):
+ """
+ The configuration is correct by the spec, but it would be rejected
+ by the client list. Check we reject it.
+ """
+ self.reject({"IN": [{
+ "type": "No such type"
+ }]})
+
if __name__ == '__main__':
unittest.main()
diff --git a/src/lib/python/isc/config/module_spec.py b/src/lib/python/isc/config/module_spec.py
index b79f928..e5568f6 100644
--- a/src/lib/python/isc/config/module_spec.py
+++ b/src/lib/python/isc/config/module_spec.py
@@ -386,6 +386,8 @@ def _validate_format(spec, value, errors):
return True
def _validate_item(spec, full, data, errors):
+ if spec.get('item_type') == 'any':
+ return True
if not _validate_type(spec, data, errors):
return False
elif type(data) == list:
More information about the bind10-changes
mailing list