BIND 10 master, updated. 5845ab9615b27fe8efa38b38622fd12a42350e04 [master] update changelog for merge of #1321
BIND 10 source code commits
bind10-changes at lists.isc.org
Wed Mar 14 17:32:42 UTC 2012
The branch, master has been updated
via 5845ab9615b27fe8efa38b38622fd12a42350e04 (commit)
via 0bb258f8610620191d75cfd5d2308b6fc558c280 (commit)
via e9a7f0106db4f30af9f64e663d39db262850f153 (commit)
via 5043998b29c17dd31a06cdfa9bcd73eb2832127b (commit)
from bc67fb7ccb6d655fd46272c1dfd89a0e58677035 (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 5845ab9615b27fe8efa38b38622fd12a42350e04
Author: Jelte Jansen <jelte at isc.org>
Date: Wed Mar 14 17:56:09 2012 +0100
[master] update changelog for merge of #1321
commit 0bb258f8610620191d75cfd5d2308b6fc558c280
Merge: bc67fb7ccb6d655fd46272c1dfd89a0e58677035 e9a7f0106db4f30af9f64e663d39db262850f153
Author: Jelte Jansen <jelte at isc.org>
Date: Wed Mar 14 17:53:38 2012 +0100
[master] Merge branch 'trac1321'
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 +++
src/bin/xfrout/xfrout.py.in | 14 +++++++---
src/bin/xfrout/xfrout.spec.pre.in | 13 +++++++++
src/lib/python/isc/notify/notify_out.py | 13 ++++++---
src/lib/python/isc/notify/tests/notify_out_test.py | 29 +++++++++++++++-----
5 files changed, 59 insertions(+), 15 deletions(-)
-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index c56c407..b62825a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+402. [func] jelte
+ b10-xfrout now has a visible command to send out notifies for
+ a given zone, callable from bindctl. Xfrout notify <zone> [class]
+ (Trac #1321, git 0bb258f8610620191d75cfd5d2308b6fc558c280)
+
401. [func]* jinmei
libdns++: updated the internal implementation of the
MessageRenderer class. This is mostly a transparent change, but
diff --git a/src/bin/xfrout/xfrout.py.in b/src/bin/xfrout/xfrout.py.in
index 165560b..8f236ec 100755
--- a/src/bin/xfrout/xfrout.py.in
+++ b/src/bin/xfrout/xfrout.py.in
@@ -926,7 +926,7 @@ class XfroutServer:
self._notifier.dispatcher()
def send_notify(self, zone_name, zone_class):
- self._notifier.send_notify(zone_name, zone_class)
+ return self._notifier.send_notify(zone_name, zone_class)
def config_handler(self, new_config):
'''Update config data. TODO. Do error check'''
@@ -982,10 +982,16 @@ class XfroutServer:
elif cmd == notify_out.ZONE_NEW_DATA_READY_CMD:
zone_name = args.get('zone_name')
zone_class = args.get('zone_class')
- if zone_name and zone_class:
+ if not zone_class:
+ zone_class = str(RRClass.IN())
+ if zone_name:
logger.info(XFROUT_NOTIFY_COMMAND, zone_name, zone_class)
- self.send_notify(zone_name, zone_class)
- answer = create_answer(0)
+ if self.send_notify(zone_name, zone_class):
+ answer = create_answer(0)
+ else:
+ zonestr = notify_out.format_zone_str(Name(zone_name),
+ zone_class)
+ answer = create_answer(1, "Unknown zone: " + zonestr)
else:
answer = create_answer(1, "Bad command parameter:" + str(args))
diff --git a/src/bin/xfrout/xfrout.spec.pre.in b/src/bin/xfrout/xfrout.spec.pre.in
index ce8686e..30c9d56 100644
--- a/src/bin/xfrout/xfrout.spec.pre.in
+++ b/src/bin/xfrout/xfrout.spec.pre.in
@@ -71,6 +71,19 @@
"item_optional": true
}
]
+ },
+ { "command_name": "notify",
+ "command_description": "Send notifies for zone",
+ "command_args": [
+ { "item_name": "zone_name",
+ "item_type": "string",
+ "item_optional": false,
+ "item_default": "" },
+ { "item_name": "zone_class",
+ "item_type": "string",
+ "item_optional": true,
+ "item_default": "IN"
+ } ]
}
]
}
diff --git a/src/lib/python/isc/notify/notify_out.py b/src/lib/python/isc/notify/notify_out.py
index 153a00a..6f3bec9 100644
--- a/src/lib/python/isc/notify/notify_out.py
+++ b/src/lib/python/isc/notify/notify_out.py
@@ -34,7 +34,7 @@ logger = isc.log.Logger("notify_out")
# initialized yet. see trac ticket #1103
from isc.dns import *
-ZONE_NEW_DATA_READY_CMD = 'zone_new_data_ready'
+ZONE_NEW_DATA_READY_CMD = 'notify'
_MAX_NOTIFY_NUM = 30
_MAX_NOTIFY_TRY_NUM = 5
_EVENT_NONE = 0
@@ -164,17 +164,19 @@ class NotifyOut:
the only interface for class NotifyOut which can be called
by other object.
Internally, the function only set the zone's notify-reply
- timeout to now, then notify message will be sent out. '''
+ timeout to now, then notify message will be sent out.
+ Returns False if the zone/class is not known, True if it is
+ (even if there are no slaves)'''
if zone_name[len(zone_name) - 1] != '.':
zone_name += '.'
zone_id = (zone_name, zone_class)
if zone_id not in self._notify_infos:
- return
+ return False
# Has no slave servers, skip it.
if (len(self._notify_infos[zone_id].notify_slaves) <= 0):
- return
+ return True
with self._lock:
if (self.notify_num >= _MAX_NOTIFY_NUM) or (zone_id in self._notifying_zones):
@@ -186,6 +188,7 @@ class NotifyOut:
self._notifying_zones.append(zone_id)
if not self._nonblock_event.isSet():
self._nonblock_event.set()
+ return True
def _dispatcher(self, started_event):
started_event.set() # Let the master know we are alive already
@@ -250,7 +253,9 @@ class NotifyOut:
self._thread.join()
# Clean up
+ self._write_sock.close()
self._write_sock = None
+ self._read_sock.close()
self._read_sock = None
self._thread = None
diff --git a/src/lib/python/isc/notify/tests/notify_out_test.py b/src/lib/python/isc/notify/tests/notify_out_test.py
index d64c203..1b3a4a1 100644
--- a/src/lib/python/isc/notify/tests/notify_out_test.py
+++ b/src/lib/python/isc/notify/tests/notify_out_test.py
@@ -114,38 +114,48 @@ class TestNotifyOut(unittest.TestCase):
notify_out._MAX_NOTIFY_NUM = 2
self._notify._nonblock_event.clear()
- self._notify.send_notify('example.net')
+ self.assertTrue(self._notify.send_notify('example.net'))
self.assertTrue(self._notify._nonblock_event.isSet())
self.assertEqual(self._notify.notify_num, 1)
self.assertEqual(self._notify._notifying_zones[0], ('example.net.', 'IN'))
- self._notify.send_notify('example.com')
+ self.assertTrue(self._notify.send_notify('example.com'))
self.assertEqual(self._notify.notify_num, 2)
self.assertEqual(self._notify._notifying_zones[1], ('example.com.', 'IN'))
# notify_num is equal to MAX_NOTIFY_NUM, append it to waiting_zones list.
self._notify._nonblock_event.clear()
- self._notify.send_notify('example.com', 'CH')
+ self.assertTrue(self._notify.send_notify('example.com', 'CH'))
# add waiting zones won't set nonblock_event.
self.assertFalse(self._notify._nonblock_event.isSet())
self.assertEqual(self._notify.notify_num, 2)
self.assertEqual(1, len(self._notify._waiting_zones))
# zone_id is already in notifying_zones list, append it to waiting_zones list.
- self._notify.send_notify('example.net')
+ self.assertTrue(self._notify.send_notify('example.net'))
self.assertEqual(2, len(self._notify._waiting_zones))
self.assertEqual(self._notify._waiting_zones[1], ('example.net.', 'IN'))
# zone_id is already in waiting_zones list, skip it.
- self._notify.send_notify('example.net')
+ self.assertTrue(self._notify.send_notify('example.net'))
self.assertEqual(2, len(self._notify._waiting_zones))
# has no slave masters, skip it.
- self._notify.send_notify('example.org.', 'CH')
+ self.assertTrue(self._notify.send_notify('example.org.', 'CH'))
self.assertEqual(self._notify.notify_num, 2)
self.assertEqual(2, len(self._notify._waiting_zones))
- self._notify.send_notify('example.org.')
+ self.assertTrue(self._notify.send_notify('example.org.'))
+ self.assertEqual(self._notify.notify_num, 2)
+ self.assertEqual(2, len(self._notify._waiting_zones))
+
+ # zone does not exist, should return False, and no change in other
+ # values
+ self.assertFalse(self._notify.send_notify('does.not.exist.'))
+ self.assertEqual(self._notify.notify_num, 2)
+ self.assertEqual(2, len(self._notify._waiting_zones))
+
+ self.assertFalse(self._notify.send_notify('example.net.', 'CH'))
self.assertEqual(self._notify.notify_num, 2)
self.assertEqual(2, len(self._notify._waiting_zones))
@@ -185,6 +195,11 @@ class TestNotifyOut(unittest.TestCase):
# Now make one socket be readable
self._notify._notify_infos[('example.net.', 'IN')].notify_timeout = time.time() + 10
self._notify._notify_infos[('example.com.', 'IN')].notify_timeout = time.time() + 10
+
+ if self._notify._read_sock is not None:
+ self._notify._read_sock.close()
+ if self._notify._write_sock is not None:
+ self._notify._write_sock.close()
self._notify._read_sock, self._notify._write_sock = socket.socketpair()
self._notify._write_sock.send(SOCK_DATA)
replied_zones, timeout_zones = self._notify._wait_for_notify_reply()
More information about the bind10-changes
mailing list