BIND 10 trac2931, updated. 79fe7149c3d2cc20d4bef791d27d5316702de53b [2931] Process incoming notifications

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Jul 1 11:29:58 UTC 2013


The branch, trac2931 has been updated
       via  79fe7149c3d2cc20d4bef791d27d5316702de53b (commit)
      from  60a57d2997cfd0bfc27d580df175b31589fdedbf (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 79fe7149c3d2cc20d4bef791d27d5316702de53b
Author: Michal 'vorner' Vaner <vorner at vorner.cz>
Date:   Mon Jul 1 13:28:30 2013 +0200

    [2931] Process incoming notifications

-----------------------------------------------------------------------

Summary of changes:
 src/lib/python/isc/config/ccsession.py |   26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/config/ccsession.py b/src/lib/python/isc/config/ccsession.py
index 136f7f1..9adc89c 100644
--- a/src/lib/python/isc/config/ccsession.py
+++ b/src/lib/python/isc/config/ccsession.py
@@ -297,8 +297,27 @@ class ModuleCCSession(ConfigData):
            configuration update. Calls the corresponding handler
            functions if present. Responds on the channel if the
            handler returns a message."""
-        # should we default to an answer? success-by-default? unhandled error?
-        if msg is not None and not CC_PAYLOAD_RESULT in msg:
+        if msg is None:
+            return
+        if CC_PAYLOAD_NOTIFICATION in msg:
+            group_s = env[CC_HEADER_GROUP].split('/', 1)
+            # What to do with these bogus inputs? We just ignore them for now.
+            if len(group_s) != 2:
+                return
+            [prefix, group] = group_s
+            if prefix + '/' != CC_GROUP_NOTIFICATION_PREFIX:
+                return
+            # Now, get the callbacks and call one by one
+            callbacks = self._notification_callbacks.get(group, {})
+            event = msg[CC_PAYLOAD_NOTIFICATION][0]
+            params = None
+            if len(msg[CC_PAYLOAD_NOTIFICATION]) > 1:
+                params = msg[CC_PAYLOAD_NOTIFICATION][1]
+            for key in sorted(callbacks.keys()):
+                callbacks[key](event, params)
+        elif not CC_PAYLOAD_RESULT in msg:
+            # should we default to an answer? success-by-default? unhandled
+            # error?
             answer = None
             try:
                 module_name = env[CC_HEADER_GROUP]
@@ -602,6 +621,9 @@ class ModuleCCSession(ConfigData):
           will be received.
         - callback (callable): The callback to be called whenever the
           notification comes.
+
+          The callback should not raise exceptions, such exceptions are
+          likely to propagate through the loop and terminate program.
         """
         self._last_notif_id += 1
         my_id = self._last_notif_id



More information about the bind10-changes mailing list