Commit 4d6719f9 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[1414] Merge branch 'trac1414' of ssh://git.bind10.isc.org/var/bind10/git/bind10 into trac1414

parents 2d0aacae 740d33cd
...@@ -569,6 +569,14 @@ class TestZonemgrRefresh(unittest.TestCase): ...@@ -569,6 +569,14 @@ class TestZonemgrRefresh(unittest.TestCase):
self.zone_refresh.update_config_data(config, self.cc_session) self.zone_refresh.update_config_data(config, self.cc_session)
self.assertTrue(("example.net.", "IN") in self.assertTrue(("example.net.", "IN") in
self.zone_refresh._zonemgr_refresh_info) self.zone_refresh._zonemgr_refresh_info)
# and with case-insensitive checking
config['secondary_zones'] = \
zone_list_from_name_classes([("Example.NeT.", "IN")])
self.zone_refresh.update_config_data(config, self.cc_session)
self.assertTrue(("example.net.", "IN") in
self.zone_refresh._zonemgr_refresh_info)
# Try some bad names # Try some bad names
config['secondary_zones'] = \ config['secondary_zones'] = \
zone_list_from_name_classes([("example..net", "IN")]) zone_list_from_name_classes([("example..net", "IN")])
...@@ -580,6 +588,17 @@ class TestZonemgrRefresh(unittest.TestCase): ...@@ -580,6 +588,17 @@ class TestZonemgrRefresh(unittest.TestCase):
self.assertRaises(ZonemgrException, self.assertRaises(ZonemgrException,
self.zone_refresh.update_config_data, self.zone_refresh.update_config_data,
config, self.cc_session) config, self.cc_session)
# Try a bad class
config['secondary_zones'] = \
zone_list_from_name_classes([("example.net", "BADCLASS")])
self.assertRaises(ZonemgrException,
self.zone_refresh.update_config_data,
config, self.cc_session)
config['secondary_zones'] = \
zone_list_from_name_classes([("example.net", "")])
self.assertRaises(ZonemgrException,
self.zone_refresh.update_config_data,
config, self.cc_session)
def tearDown(self): def tearDown(self):
sys.stderr= self.stderr_backup sys.stderr= self.stderr_backup
......
...@@ -483,11 +483,17 @@ class ZonemgrRefresh: ...@@ -483,11 +483,17 @@ class ZonemgrRefresh:
# (then this entire method can be simplified a lot, and we # (then this entire method can be simplified a lot, and we
# wouldn't need direct access to the ccsession object) # wouldn't need direct access to the ccsession object)
if 'class' in secondary_zone: if 'class' in secondary_zone:
name_class = (name, secondary_zone['class']) rr_class = secondary_zone['class']
else: else:
name_class = (name, rr_class = module_cc_session.get_default_value(
module_cc_session.get_default_value( 'secondary_zones/class')
'secondary_zones/class')) # Convert rr_class to and from RRClass to check its value
try:
name_class = (name, isc.dns.RRClass(rr_class).to_text())
except isc.dns.InvalidRRClass:
raise ZonemgrException("Bad RR class '" +
rr_class +
"' for zone " + name)
required[name_class] = True required[name_class] = True
# Add it only if it isn't there already # Add it only if it isn't there already
if not name_class in self._zonemgr_refresh_info: if not name_class in self._zonemgr_refresh_info:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment