BIND 10 trac811, updated. fd64f870222ac95fc7d3eea86e41052883210f49 [trac811] add master_addr, port and tsig_key to secondary zone config data
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Apr 12 14:22:37 UTC 2011
The branch, trac811 has been updated
via fd64f870222ac95fc7d3eea86e41052883210f49 (commit)
from a21f241b02d5f260dbce6c6621bffbd165879cfd (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 fd64f870222ac95fc7d3eea86e41052883210f49
Author: Jelte Jansen <jelte at isc.org>
Date: Tue Apr 12 16:21:33 2011 +0200
[trac811] add master_addr, port and tsig_key to secondary zone config data
-----------------------------------------------------------------------
Summary of changes:
src/bin/zonemgr/tests/zonemgr_test.py | 26 +++++++++++++++++++++++++-
src/bin/zonemgr/zonemgr.py.in | 24 ++++++++++++++++++++----
2 files changed, 45 insertions(+), 5 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/zonemgr/tests/zonemgr_test.py b/src/bin/zonemgr/tests/zonemgr_test.py
index c62543a..2c7aab7 100644
--- a/src/bin/zonemgr/tests/zonemgr_test.py
+++ b/src/bin/zonemgr/tests/zonemgr_test.py
@@ -23,7 +23,8 @@ from zonemgr import *
ZONE_DATA_1_IN = ZoneData("sd.cn.", "IN")
ZONE_NAME_CLASS1_IN = ZONE_DATA_1_IN.getNameClass()
-ZONE_NAME_CLASS2_CH = ("tw.cn.", "CH")
+ZONE_DATA_2_CH = ZoneData("tw.cn.", "CH")
+ZONE_NAME_CLASS2_CH = ZONE_DATA_2_CH.getNameClass()
ZONE_NAME_CLASS3_IN = ("example.com", "IN")
ZONE_NAME_CLASS1_CH = ("sd.cn.", "CH")
ZONE_NAME_CLASS2_IN = ("tw.cn.", "IN")
@@ -464,6 +465,29 @@ class TestZonemgrRefresh(unittest.TestCase):
self.zone_refresh.update_config_data(config)
self.assertTrue(("sd.cn.", "IN") in
self.zone_refresh._zonemgr_refresh_info)
+ zone_data = self.zone_refresh._zonemgr_refresh_info[("sd.cn.", "IN")]
+ self.assertIsNone(zone_data.master_addr)
+ self.assertEqual(53, zone_data.master_port)
+ self.assertIsNone(zone_data.tsig_key)
+
+ # Try one with master address, port and tsig_key
+ # Once we have #781 merged, we should check the TSIG key,
+ # and check for error here, and add another test with a correct
+ # key
+ config.zone_list = [{ "name": "sd.cn.",
+ "class": "IN",
+ "master_address": "127.0.0.1",
+ "master_port": 5432,
+ "tsig_key": "fakekey"
+ }]
+ self.zone_refresh.update_config_data(config)
+ self.assertTrue(("sd.cn.", "IN") in
+ self.zone_refresh._zonemgr_refresh_info)
+ zone_data = self.zone_refresh._zonemgr_refresh_info[("sd.cn.", "IN")]
+ self.assertEqual("127.0.0.1", zone_data.master_addr)
+ self.assertEqual(5432, zone_data.master_port)
+ self.assertEqual("fakekey", zone_data.tsig_key)
+
# This one does not exist
config.set_zone_list_from_name_classes(["example.net", "CH"])
self.assertRaises(ZonemgrException,
diff --git a/src/bin/zonemgr/zonemgr.py.in b/src/bin/zonemgr/zonemgr.py.in
index 5cdb887..f86d928 100755
--- a/src/bin/zonemgr/zonemgr.py.in
+++ b/src/bin/zonemgr/zonemgr.py.in
@@ -91,11 +91,13 @@ class ZoneData:
"""This class keeps information about the zones as taken from
the configuration: name, class, master_addr, master_port, and
tsig key (as a string), as well as the refresh info"""
- def __init__(self, zname_, zclass_, master_addr_ = None):
+ def __init__(self, zname_, zclass_):
# values from config
self.zname = zname_
self.zclass = zclass_
- self.master_addr = master_addr_
+ self.master_addr = None
+ self.master_port = 53
+ self.tsig_key = None
# refres info
self.zone_soa_rdata = None
@@ -110,6 +112,11 @@ class ZoneData:
ZonemgrRefresh, which (right now) is a dict"""
return (self.zname, self.zclass)
+ def updateConfigValue(self, other):
+ self.master_addr = other.master_addr
+ self.master_port = other.master_port
+ self.tsig_key = other.tsig_key
+
class ZonemgrRefresh:
"""This class will maintain and manage zone refresh info.
It also provides methods to keep track of zone timers and
@@ -436,10 +443,19 @@ class ZonemgrRefresh:
zone_data = ZoneData(zname, zclass)
required[name_class] = True
### Add additional info here for master addrs/tsig TODO
-
- # Add it only if it isn't there already
+ if 'master_address' in secondary_zone:
+ zone_data.master_addr = secondary_zone['master_address']
+ if 'master_port' in secondary_zone:
+ zone_data.master_port = secondary_zone['master_port']
+ if 'tsig_key' in secondary_zone:
+ zone_data.tsig_key = secondary_zone['tsig_key']
+ # If it is there already, we should update the config
+ # values, but leave the timers
if not name_class in self._zonemgr_refresh_info:
self.zonemgr_add_zone(zone_data)
+ else:
+ self._zonemgr_refresh_info[name_class].updateConfigValue(zone_data)
+
# Drop the zones that are no longer there
# Do it in two phases, python doesn't like deleting while iterating
to_drop = []
More information about the bind10-changes
mailing list