BIND 10 trac213-incremental, updated. 3a25578a01620918cd722e430b61c0fe91177e0a [213] Document flexibility of overridden components

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Nov 1 13:24:00 UTC 2011


The branch, trac213-incremental has been updated
       via  3a25578a01620918cd722e430b61c0fe91177e0a (commit)
       via  8f876a23792b3feeedb807a66a08cd4f62d60d8a (commit)
       via  6cfcb5a3c784f774702d9ca183e13f6b6690b74d (commit)
      from  af0b62cf1161739d3a1244750b60d3e6b75a22e8 (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 3a25578a01620918cd722e430b61c0fe91177e0a
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Tue Nov 1 14:22:59 2011 +0100

    [213] Document flexibility of overridden components

commit 8f876a23792b3feeedb807a66a08cd4f62d60d8a
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Tue Nov 1 14:15:38 2011 +0100

    [213] Return library path workaround for xfrin

commit 6cfcb5a3c784f774702d9ca183e13f6b6690b74d
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Tue Nov 1 13:46:38 2011 +0100

    [213] Missing call

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

Summary of changes:
 src/bin/bind10/bind10_src.py.in                   |   36 +++++++++++++++++++-
 src/lib/python/isc/bind10/component.py            |    8 ++++-
 src/lib/python/isc/bind10/special_component.py    |    9 +++++-
 src/lib/python/isc/bind10/tests/component_test.py |    6 +++-
 4 files changed, 54 insertions(+), 5 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/bind10/bind10_src.py.in b/src/bin/bind10/bind10_src.py.in
index d6dcb4b..6fe3693 100755
--- a/src/bin/bind10/bind10_src.py.in
+++ b/src/bin/bind10/bind10_src.py.in
@@ -341,7 +341,7 @@ class BoB:
             self.component_config['b10-xfrout'] = { 'kind': 'dispensable',
                                                     'address': 'Xfrout' }
             self.component_config['b10-xfrin'] = { 'kind': 'dispensable',
-                                                   'address': 'Xfrin' }
+                                                   'special': 'xfrin' }
             self.component_config['b10-zonemgr'] = { 'kind': 'dispensable',
                                                      'address': 'Zonemgr' }
             self.__propagate_component_config(self.component_config)
@@ -690,6 +690,37 @@ class BoB:
         return self.start_process("b10-cmdctl", args, self.c_channel_env,
                                   self.cmdctl_port)
 
+    def start_xfrin(self):
+        # XXX: a quick-hack workaround.  xfrin will implicitly use dynamically
+        # loadable data source modules, which will be installed in $(libdir).
+        # On some OSes (including MacOS X and *BSDs) the main process (python)
+        # cannot find the modules unless they are located in a common shared
+        # object path or a path in the (DY)LD_LIBRARY_PATH.  We should seek
+        # a cleaner solution, but for a short term workaround we specify the
+        # path here, unconditionally, and without even bothering which
+        # environment variable should be used.
+        #
+        # We reuse the ADD_LIBEXEC_PATH variable to see whether we need to
+        # do this, as the conditions that make this workaround needed are
+        # the same as for the libexec path addition
+        # TODO: Once #1292 is finished, remove this method and the special
+        # component, use it as normal component.
+        c_channel_env = dict(self.c_channel_env)
+        if ADD_LIBEXEC_PATH:
+            cur_path = os.getenv('DYLD_LIBRARY_PATH')
+            cur_path = '' if cur_path is None else ':' + cur_path
+            c_channel_env['DYLD_LIBRARY_PATH'] = "@@LIBDIR@@" + cur_path
+
+            cur_path = os.getenv('LD_LIBRARY_PATH')
+            cur_path = '' if cur_path is None else ':' + cur_path
+            c_channel_env['LD_LIBRARY_PATH'] = "@@LIBDIR@@" + cur_path
+        # Set up the command arguments.
+        args = ['b10-xfrin']
+        if self.verbose:
+            args += ['-v']
+
+        return self.start_process("b10-xfrin", args, c_channel_env)
+
     def start_all_processes(self):
         """
             Starts up all the processes.  Any exception generated during the
@@ -721,6 +752,7 @@ class BoB:
             component_config['b10-resolver'] = { 'kind': 'needed',
                                                  'special': 'resolver' }
             self.started_resolver_family = True
+            self.__propagate_component_config(component_config)
 
         # Everything after the main components can run as non-root.
         # TODO: this is only temporary - once the privileged socket creator is
@@ -734,7 +766,7 @@ class BoB:
             component_config['b10-xfrout'] = { 'kind': 'dispensable',
                                                'address': 'Xfrout' }
             component_config['b10-xfrin'] = { 'kind': 'dispensable',
-                                              'address': 'Xfrin' }
+                                              'special': 'xfrin' }
             component_config['b10-zonemgr'] = { 'kind': 'dispensable',
                                               'address': 'Zonemgr' }
             self.__propagate_component_config(component_config)
diff --git a/src/lib/python/isc/bind10/component.py b/src/lib/python/isc/bind10/component.py
index 789ef45..6763ffc 100644
--- a/src/lib/python/isc/bind10/component.py
+++ b/src/lib/python/isc/bind10/component.py
@@ -56,7 +56,6 @@ class Component:
 
     The methods are marked if it is expected for them to be overridden.
 
-
     The component is in one of the three states:
     - Stopped - it is either not started yet or it was explicitly stopped.
       The component is created in this state (it must be asked to start
@@ -175,6 +174,13 @@ class Component:
         as well. You should also register any processes started within boss.
         (In fact, you could set the _procinfo variable and use the provided
         ones, but then you are OK with providing _start_func anyway).
+
+        The ability to override this method presents some flexibility. It
+        allows processes started in a strange way, as well as components that
+        have no processes at all or components with multiple processes (in case
+        of multiple processes, care should be taken to make their
+        started/stopped state in sync and all the processes that can fail
+        should be registered).
         """
         # This one is not tested. For one, it starts a real process
         # which is out of scope of unit tests, for another, it just
diff --git a/src/lib/python/isc/bind10/special_component.py b/src/lib/python/isc/bind10/special_component.py
index 6d07187..d44928a 100644
--- a/src/lib/python/isc/bind10/special_component.py
+++ b/src/lib/python/isc/bind10/special_component.py
@@ -81,6 +81,11 @@ class CmdCtl(Component):
         Component.__init__(self, process, boss, kind, 'Cmdctl')
         self._start_func = boss.start_cmdctl
 
+class XfrIn(Component):
+    def __init__(self, process, boss, kind, address=None, params=None):
+        Component.__init__(self, process, boss, kind, 'Xfrin')
+        self._start_func = boss.start_xfrin
+
 def get_specials():
     """
     List of specially started components. Each one should be the class than can
@@ -94,5 +99,7 @@ def get_specials():
         # They should not have any parameters anyway
         'auth': Auth,
         'resolver': Resolver,
-        'cmdctl': CmdCtl
+        'cmdctl': CmdCtl,
+        # FIXME: Temporary workaround before #1292 is done
+        'xfrin': XfrIn
     }
diff --git a/src/lib/python/isc/bind10/tests/component_test.py b/src/lib/python/isc/bind10/tests/component_test.py
index ac94ea3..d884b57 100644
--- a/src/lib/python/isc/bind10/tests/component_test.py
+++ b/src/lib/python/isc/bind10/tests/component_test.py
@@ -86,6 +86,9 @@ class BossUtils:
     def start_cmdctl(self):
         pass
 
+    def start_xfrin(self):
+        pass
+
 class ComponentTests(BossUtils, unittest.TestCase):
     """
     Tests for the bind10.component.Component class
@@ -420,7 +423,8 @@ class ComponentTests(BossUtils, unittest.TestCase):
                                isc.bind10.special_component.CfgMgr,
                                isc.bind10.special_component.Auth,
                                isc.bind10.special_component.Resolver,
-                               isc.bind10.special_component.CmdCtl]:
+                               isc.bind10.special_component.CmdCtl,
+                               isc.bind10.special_component.XfrIn]:
             component = component_type('none', self, 'needed')
             self.assertIsNone(component.pid())
 




More information about the bind10-changes mailing list