BIND 10 trac2676, updated. cee365b41dfe5e24b62d02d21a2f52749bb19688 [2676] Remove unused variable

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Feb 19 09:30:15 UTC 2013


The branch, trac2676 has been updated
       via  cee365b41dfe5e24b62d02d21a2f52749bb19688 (commit)
       via  f5ba7aa63517eaada091025d8ec61a34b797a743 (commit)
       via  2e5d462ccc30e3c63f82ced6aa9a3c4732562188 (commit)
       via  1b746a6a6ab6eaa92aa9ba913b690dad4c930378 (commit)
      from  773d25dc86682595c2af983b7c349deea9abb0b6 (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 cee365b41dfe5e24b62d02d21a2f52749bb19688
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Tue Feb 19 10:29:57 2013 +0100

    [2676] Remove unused variable

commit f5ba7aa63517eaada091025d8ec61a34b797a743
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Tue Feb 19 10:19:20 2013 +0100

    [2676] (minor) Comment clarification

commit 2e5d462ccc30e3c63f82ced6aa9a3c4732562188
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Tue Feb 19 10:12:59 2013 +0100

    [2676] Error when missing ConfigManager
    
    In the code before refactoring, when the CfgMgr wasn't there, it did a
    SessionTimeout. Now the RPCRecipientMissing is raised instead, but as it
    is subclass of RPCError, we need to exclude it from the error ignoring.
    
    Actually, the error ignoring itself is very questionable thing, but it
    is as it was before.

commit 1b746a6a6ab6eaa92aa9ba913b690dad4c930378
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Tue Feb 19 10:09:31 2013 +0100

    [2676] Make the try-except block smaller
    
    As the rpc_call is the only place the exception can be raised from, this
    is equivalent, just cleaner.

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

Summary of changes:
 src/bin/stats/stats.py.in             |   66 ++++++++++++++++++---------------
 src/bin/zonemgr/tests/zonemgr_test.py |    8 ++--
 src/bin/zonemgr/zonemgr.py.in         |    6 +--
 3 files changed, 42 insertions(+), 38 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/stats/stats.py.in b/src/bin/stats/stats.py.in
index 925ba53..faa80d8 100755
--- a/src/bin/stats/stats.py.in
+++ b/src/bin/stats/stats.py.in
@@ -253,38 +253,42 @@ class Stats:
         # 'show_processes' of Init
         try:
             value = self.mccs.rpc_call('show_processes', 'Init')
-            if type(value) is list:
-                # NOTE: For example, the "show_processes" command
-                # of Init is assumed to return the response in this
-                # format:
-                #  [
-                #  ...
-                #    [
-                #      20061,
-                #      "b10-auth",
-                #      "Auth"
-                #    ],
-                #    [
-                #      20103,
-                #      "b10-auth-2",
-                #      "Auth"
-                #    ]
-                #  ...
-                #  ]
-                # If multiple instances of the same module are
-                # running, the address names of them, which are at the
-                # third element, must be also same. Thus, the value of
-                # the third element of each outer element is read here
-                # for counting multiple instances.  This is a
-                # workaround for counting the instances. This should
-                # be fixed in another proper way in the future
-                # release.
-                modules = [ v[2] if type(v) is list and len(v) > 2 \
-                                else None for v in value ]
+        except isc.config.RPCRecipientMissing:
+            # This has been SessionTimeout before, so we keep the original
+            # behavior.
+            raise
         except isc.config.RPCError:
             # TODO: Is it OK to just pass? As part of refactoring, preserving
             # the original behaviour.
             pass
+        if type(value) is list:
+            # NOTE: For example, the "show_processes" command
+            # of Init is assumed to return the response in this
+            # format:
+            #  [
+            #  ...
+            #    [
+            #      20061,
+            #      "b10-auth",
+            #      "Auth"
+            #    ],
+            #    [
+            #      20103,
+            #      "b10-auth-2",
+            #      "Auth"
+            #    ]
+            #  ...
+            #  ]
+            # If multiple instances of the same module are
+            # running, the address names of them, which are at the
+            # third element, must be also same. Thus, the value of
+            # the third element of each outer element is read here
+            # for counting multiple instances.  This is a
+            # workaround for counting the instances. This should
+            # be fixed in another proper way in the future
+            # release.
+            modules = [ v[2] if type(v) is list and len(v) > 2 \
+                            else None for v in value ]
         # start requesting each module to collect statistics data
         sequences = []
         for (module_name, data) in self.get_statistics_data().items():
@@ -295,8 +299,10 @@ class Stats:
                          module_name)
             cmd = isc.config.ccsession.create_command(
                 "getstats", None) # no argument
-            # Not using rpc_call here, we query a lot of modules in parallel
-            # here
+            # Not using rpc_call here. We first send a bunch of commands, then
+            # collect all the answers. This eliminates some of the round-time
+            # trips. Unfortunately, rpc_call is not flexible enough to allow
+            # this, though the future rpc_call_async could.
             seq = self.cc_session.group_sendmsg(cmd, module_name,
                                                 want_answer=True)
             sequences.append((module_name, seq))
diff --git a/src/bin/zonemgr/tests/zonemgr_test.py b/src/bin/zonemgr/tests/zonemgr_test.py
index f8acf66..81c5392 100644
--- a/src/bin/zonemgr/tests/zonemgr_test.py
+++ b/src/bin/zonemgr/tests/zonemgr_test.py
@@ -77,8 +77,8 @@ class MyZonemgrRefresh(ZonemgrRefresh):
                 return None
         sqlite3_ds.get_zone_soa = get_zone_soa
 
-        ZonemgrRefresh.__init__(self, None, TEST_SQLITE3_DBFILE,
-                                self._slave_socket, FakeCCSession())
+        ZonemgrRefresh.__init__(self, TEST_SQLITE3_DBFILE, self._slave_socket,
+                                FakeCCSession())
         current_time = time.time()
         self._zonemgr_refresh_info = {
          ('example.net.', 'IN'): {
@@ -656,8 +656,8 @@ class TestZonemgr(unittest.TestCase):
         self.zonemgr.config_handler(config_data3)
         self.assertEqual(0.5, self.zonemgr._config_data.get("refresh_jitter"))
         # The zone doesn't exist in database, simply skip loading soa for it and log an warning
-        self.zonemgr._zone_refresh = ZonemgrRefresh(None, TEST_SQLITE3_DBFILE,
-                                                    None, FakeCCSession())
+        self.zonemgr._zone_refresh = ZonemgrRefresh(TEST_SQLITE3_DBFILE, None,
+                                                    FakeCCSession())
         config_data1["secondary_zones"] = [{"name": "nonexistent.example",
                                             "class": "IN"}]
         self.assertEqual(self.zonemgr.config_handler(config_data1),
diff --git a/src/bin/zonemgr/zonemgr.py.in b/src/bin/zonemgr/zonemgr.py.in
index 1f18fd5..94e93f8 100755
--- a/src/bin/zonemgr/zonemgr.py.in
+++ b/src/bin/zonemgr/zonemgr.py.in
@@ -103,8 +103,7 @@ class ZonemgrRefresh:
     can be stopped by calling shutdown() in another thread.
     """
 
-    def __init__(self, cc, db_file, slave_socket, module_cc_session):
-        self._cc = cc
+    def __init__(self, db_file, slave_socket, module_cc_session):
         self._mccs = module_cc_session
         self._check_sock = slave_socket
         self._db_file = db_file
@@ -523,7 +522,7 @@ class Zonemgr:
         self._db_file = self.get_db_file()
         # Create socket pair for communicating between main thread and zonemgr timer thread
         self._master_socket, self._slave_socket = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM)
-        self._zone_refresh = ZonemgrRefresh(self._cc, self._db_file, self._slave_socket, self._module_cc)
+        self._zone_refresh = ZonemgrRefresh(self._db_file, self._slave_socket, self._module_cc)
         self._zone_refresh.run_timer()
 
         self._lock = threading.Lock()
@@ -534,7 +533,6 @@ class Zonemgr:
         """Setup two sessions for zonemgr, one(self._module_cc) is used for receiving
         commands and config data sent from other modules, another one (self._cc)
         is used to send commands to proper modules."""
-        self._cc = isc.cc.Session()
         self._module_cc = isc.config.ModuleCCSession(SPECFILE_LOCATION,
                                                   self.config_handler,
                                                   self.command_handler)



More information about the bind10-changes mailing list