BIND 10 trac2113, updated. 22af7691098b53daf64e90313bfd53d5e240d61c [2113] Construct the classes
BIND 10 source code commits
bind10-changes at lists.isc.org
Sat Jul 28 11:35:24 UTC 2012
The branch, trac2113 has been updated
via 22af7691098b53daf64e90313bfd53d5e240d61c (commit)
from d3892b7807918a8b0e747958c8a29cc77e1f49bc (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 22af7691098b53daf64e90313bfd53d5e240d61c
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Sat Jul 28 13:33:16 2012 +0200
[2113] Construct the classes
-----------------------------------------------------------------------
Summary of changes:
src/bin/cfgmgr/plugins/datasrc_config_plugin.py | 21 +++++++++++++--------
src/bin/cfgmgr/plugins/tests/datasrc_test.py | 16 +++++++++++++---
2 files changed, 26 insertions(+), 11 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/cfgmgr/plugins/datasrc_config_plugin.py b/src/bin/cfgmgr/plugins/datasrc_config_plugin.py
index 94fd079..a3f204f 100644
--- a/src/bin/cfgmgr/plugins/datasrc_config_plugin.py
+++ b/src/bin/cfgmgr/plugins/datasrc_config_plugin.py
@@ -16,6 +16,7 @@
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
spec = module_spec_from_file(path_search('datasrc.spec', PLUGIN_PATHS))
def check(config):
@@ -26,14 +27,18 @@ def check(config):
errors=[]
if not spec.validate_config(False, config, errors):
return ' '.join(errors)
- # TODO: Once we have solved ticket #2051, create the list and
- # fill it with the configuration. We probably want to have some way
- # to not load the data sources, just the configuration. It could
- # be hacked together by subclassing ConfigurableClientList and
- # having empty getDataSource method. But it looks like a hack and it
- # won't really check the params configuration.
- #
- # For now, we let everything pass.
+
+ classes = config.get('classes')
+ # Nothing passed here
+ if classes is None:
+ return None
+
+ for rr_class_str in classes:
+ try:
+ rr_class = isc.dns.RRClass(rr_class_str)
+ except isc.dns.InvalidRRClass as irc:
+ return str(irc)
+
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 cb42220..e703d5d 100644
--- a/src/bin/cfgmgr/plugins/tests/datasrc_test.py
+++ b/src/bin/cfgmgr/plugins/tests/datasrc_test.py
@@ -26,14 +26,14 @@ class DatasrcTest(unittest.TestCase):
"""
Just a shortcut to check the config is rejected.
"""
- self.assertIsNotNone(datasrc_config_plugin.check({"datasources":
+ self.assertIsNotNone(datasrc_config_plugin.check({"classes":
config}))
def accept(self, config):
"""
Just a shortcut to check the config is accepted.
"""
- self.assertIsNone(datasrc_config_plugin.check({"datasources":
+ self.assertIsNone(datasrc_config_plugin.check({"classes":
config}))
def test_load(self):
@@ -50,7 +50,7 @@ class DatasrcTest(unittest.TestCase):
"""
Check an empty input is OK.
"""
- self.assertIsNone(datasrc_config_plugin.check({}))
+ self.accept({})
def test_invalid_spec(self):
"""
@@ -63,5 +63,15 @@ class DatasrcTest(unittest.TestCase):
self.reject({"IN": {}})
self.reject({"IN": [{"bad-name": True}]})
+ def test_class(self):
+ """
+ The class is rejected, if it is wrong.
+ """
+ self.reject({"BAD": []})
+ self.reject({"": []})
+ # But with a good one, it works
+ for c in ["IN", "CH", "HS"]:
+ self.accept({c: []})
+
if __name__ == '__main__':
unittest.main()
More information about the bind10-changes
mailing list