Commit bdd00552 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

[1414] added class check as well, and test for case-insensitivity

parent 23350205
......@@ -569,6 +569,14 @@ class TestZonemgrRefresh(unittest.TestCase):
self.zone_refresh.update_config_data(config, self.cc_session)
self.assertTrue(("example.net.", "IN") in
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
config['secondary_zones'] = \
zone_list_from_name_classes([("example..net", "IN")])
......@@ -580,6 +588,17 @@ class TestZonemgrRefresh(unittest.TestCase):
self.assertRaises(ZonemgrException,
self.zone_refresh.update_config_data,
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):
sys.stderr= self.stderr_backup
......
......@@ -483,11 +483,17 @@ class ZonemgrRefresh:
# (then this entire method can be simplified a lot, and we
# wouldn't need direct access to the ccsession object)
if 'class' in secondary_zone:
name_class = (name, secondary_zone['class'])
rr_class = secondary_zone['class']
else:
name_class = (name,
module_cc_session.get_default_value(
'secondary_zones/class'))
rr_class = module_cc_session.get_default_value(
'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 as irce:
raise ZonemgrException("Bad RR class '" +
rr_class +
"' for zone " + name)
required[name_class] = True
# Add it only if it isn't there already
if not name_class in self._zonemgr_refresh_info:
......
Supports Markdown
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