Parcourir la source

[trac615] Pass the config options to cfgmgr

Any idea how to reasonably test this? Boss and it's tests seem to be
written in test-unfriendly way for this :-(.
Michal 'vorner' Vaner il y a 14 ans
Parent
commit
07c01a7a90
1 fichiers modifiés avec 16 ajouts et 5 suppressions
  1. 16 5
      src/bin/bind10/bind10.py.in

+ 16 - 5
src/bin/bind10/bind10.py.in

@@ -194,14 +194,17 @@ class CChannelConnectError(Exception): pass
 class BoB:
 class BoB:
     """Boss of BIND class."""
     """Boss of BIND class."""
     
     
-    def __init__(self, msgq_socket_file=None, nocache=False, verbose=False,
+    def __init__(self, msgq_socket_file=None, data_path = None,
-    setuid=None, username=None):
+    config_filename = None, nocache=False, verbose=False, setuid=None,
+    username=None):
         """
         """
             Initialize the Boss of BIND. This is a singleton (only one can run).
             Initialize the Boss of BIND. This is a singleton (only one can run).
         
         
             The msgq_socket_file specifies the UNIX domain socket file that the
             The msgq_socket_file specifies the UNIX domain socket file that the
             msgq process listens on.  If verbose is True, then the boss reports
             msgq process listens on.  If verbose is True, then the boss reports
             what it is doing.
             what it is doing.
+
+            Data path and config filename are passed trough to config manager.
         """
         """
         self.cc_session = None
         self.cc_session = None
         self.ccs = None
         self.ccs = None
@@ -219,6 +222,8 @@ class BoB:
         self.uid = setuid
         self.uid = setuid
         self.username = username
         self.username = username
         self.verbose = verbose
         self.verbose = verbose
+        self.data_path = data_path
+        self.config_filename = config_filename
 
 
     def config_handler(self, new_config):
     def config_handler(self, new_config):
         # If this is initial update, don't do anything now, leave it to startup
         # If this is initial update, don't do anything now, leave it to startup
@@ -390,7 +395,12 @@ class BoB:
             Starts the configuration manager process
             Starts the configuration manager process
         """
         """
         self.log_starting("b10-cfgmgr")
         self.log_starting("b10-cfgmgr")
-        bind_cfgd = ProcessInfo("b10-cfgmgr", ["b10-cfgmgr"],
+        opts = ["b10-cfgmgr"]
+        if self.data_path is not None:
+            opts.append("--data-path=" + self.data_path)
+        if self.config_filename is not None:
+            opts.append("--database-filename=" + self.config_filename)
+        bind_cfgd = ProcessInfo("b10-cfgmgr", opts,
                                 c_channel_env, uid=self.uid,
                                 c_channel_env, uid=self.uid,
                                 username=self.username)
                                 username=self.username)
         self.processes[bind_cfgd.pid] = bind_cfgd
         self.processes[bind_cfgd.pid] = bind_cfgd
@@ -872,8 +882,9 @@ def main():
     signal.signal(signal.SIGPIPE, signal.SIG_IGN)
     signal.signal(signal.SIGPIPE, signal.SIG_IGN)
 
 
     # Go bob!
     # Go bob!
-    boss_of_bind = BoB(options.msgq_socket_file, options.nocache,
+    boss_of_bind = BoB(options.msgq_socket_file, options.data_path,
-                       options.verbose, setuid, username)
+                       options.config_file, options.nocache, options.verbose,
+                       setuid, username)
     startup_result = boss_of_bind.startup()
     startup_result = boss_of_bind.startup()
     if startup_result:
     if startup_result:
         sys.stderr.write("[bind10] Error on startup: %s\n" % startup_result)
         sys.stderr.write("[bind10] Error on startup: %s\n" % startup_result)