Browse Source

[trac1096] change default handle_logging_config to true

so that *not* using it must be specified explicitely
changed most test cases to not set it (as they are testing other things)
Jelte Jansen 14 years ago
parent
commit
eea48a1e96

+ 1 - 2
src/bin/bind10/bind10.py.in

@@ -462,8 +462,7 @@ class BoB:
         self.log_starting("ccsession")
         self.log_starting("ccsession")
         self.ccs = isc.config.ModuleCCSession(SPECFILE_LOCATION, 
         self.ccs = isc.config.ModuleCCSession(SPECFILE_LOCATION, 
                                       self.config_handler,
                                       self.config_handler,
-                                      self.command_handler,
-                                      None, True)
+                                      self.command_handler)
         self.ccs.start()
         self.ccs.start()
         self.log_started()
         self.log_started()
 
 

+ 1 - 2
src/bin/cmdctl/cmdctl.py.in

@@ -252,8 +252,7 @@ class CommandControl():
         self._cc = isc.cc.Session()
         self._cc = isc.cc.Session()
         self._module_cc = isc.config.ModuleCCSession(SPECFILE_LOCATION,
         self._module_cc = isc.config.ModuleCCSession(SPECFILE_LOCATION,
                                               self.config_handler,
                                               self.config_handler,
-                                              self.command_handler,
-                                              None, True)
+                                              self.command_handler)
         self._module_name = self._module_cc.get_module_spec().get_module_name()
         self._module_name = self._module_cc.get_module_spec().get_module_name()
         self._cmdctl_config_data = self._module_cc.get_full_config()
         self._cmdctl_config_data = self._module_cc.get_full_config()
         self._module_cc.start()
         self._module_cc.start()

+ 1 - 2
src/bin/resolver/main.cc

@@ -208,8 +208,7 @@ main(int argc, char* argv[]) {
         cc_session = new Session(io_service.get_io_service());
         cc_session = new Session(io_service.get_io_service());
         config_session = new ModuleCCSession(specfile, *cc_session,
         config_session = new ModuleCCSession(specfile, *cc_session,
                                              my_config_handler,
                                              my_config_handler,
-                                             my_command_handler,
-                                             true, true);
+                                             my_command_handler);
         LOG_DEBUG(resolver_logger, RESOLVER_DBG_INIT, RESOLVER_CONFIG_CHANNEL);
         LOG_DEBUG(resolver_logger, RESOLVER_DBG_INIT, RESOLVER_CONFIG_CHANNEL);
 
 
         // FIXME: This does not belong here, but inside Boss
         // FIXME: This does not belong here, but inside Boss

+ 1 - 2
src/bin/xfrin/xfrin.py.in

@@ -548,8 +548,7 @@ class Xfrin:
         self._send_cc_session = isc.cc.Session()
         self._send_cc_session = isc.cc.Session()
         self._module_cc = isc.config.ModuleCCSession(SPECFILE_LOCATION,
         self._module_cc = isc.config.ModuleCCSession(SPECFILE_LOCATION,
                                               self.config_handler,
                                               self.config_handler,
-                                              self.command_handler,
-                                              None, True)
+                                              self.command_handler)
         self._module_cc.start()
         self._module_cc.start()
         config_data = self._module_cc.get_full_config()
         config_data = self._module_cc.get_full_config()
         self.config_handler(config_data)
         self.config_handler(config_data)

+ 1 - 1
src/bin/xfrout/xfrout.py.in

@@ -566,7 +566,7 @@ class XfroutServer:
         #self._log = None
         #self._log = None
         self._listen_sock_file = UNIX_SOCKET_FILE
         self._listen_sock_file = UNIX_SOCKET_FILE
         self._shutdown_event = threading.Event()
         self._shutdown_event = threading.Event()
-        self._cc = isc.config.ModuleCCSession(SPECFILE_LOCATION, self.config_handler, self.command_handler, None, True)
+        self._cc = isc.config.ModuleCCSession(SPECFILE_LOCATION, self.config_handler, self.command_handler)
         self._config_data = self._cc.get_full_config()
         self._config_data = self._cc.get_full_config()
         self._cc.start()
         self._cc.start()
         self._cc.add_remote_config(AUTH_SPECFILE_LOCATION);
         self._cc.add_remote_config(AUTH_SPECFILE_LOCATION);

+ 2 - 2
src/lib/config/ccsession.h

@@ -179,7 +179,7 @@ public:
      * We'll need to develop a cleaner solution, and then remove this knob)
      * We'll need to develop a cleaner solution, and then remove this knob)
      * @param handle_logging If true, the ModuleCCSession will automatically
      * @param handle_logging If true, the ModuleCCSession will automatically
      * take care of logging configuration through the virtual Logging config
      * take care of logging configuration through the virtual Logging config
-     * module.
+     * module. Defaults to true.
      */
      */
     ModuleCCSession(const std::string& spec_file_name,
     ModuleCCSession(const std::string& spec_file_name,
                     isc::cc::AbstractSession& session,
                     isc::cc::AbstractSession& session,
@@ -189,7 +189,7 @@ public:
                         const std::string& command,
                         const std::string& command,
                         isc::data::ConstElementPtr args) = NULL,
                         isc::data::ConstElementPtr args) = NULL,
                     bool start_immediately = true,
                     bool start_immediately = true,
-                    bool handle_logging = false
+                    bool handle_logging = true
                     );
                     );
 
 
     /// Start receiving new commands and configuration changes asynchronously.
     /// Start receiving new commands and configuration changes asynchronously.

+ 19 - 13
src/lib/config/tests/ccsession_unittests.cc

@@ -151,7 +151,8 @@ TEST_F(CCSessionTest, parseCommand) {
 
 
 TEST_F(CCSessionTest, session1) {
 TEST_F(CCSessionTest, session1) {
     EXPECT_FALSE(session.haveSubscription("Spec1", "*"));
     EXPECT_FALSE(session.haveSubscription("Spec1", "*"));
-    ModuleCCSession mccs(ccspecfile("spec1.spec"), session, NULL, NULL);
+    ModuleCCSession mccs(ccspecfile("spec1.spec"), session, NULL, NULL,
+                         true, false);
     EXPECT_TRUE(session.haveSubscription("Spec1", "*"));
     EXPECT_TRUE(session.haveSubscription("Spec1", "*"));
 
 
     EXPECT_EQ(1, session.getMsgQueue()->size());
     EXPECT_EQ(1, session.getMsgQueue()->size());
@@ -163,14 +164,15 @@ TEST_F(CCSessionTest, session1) {
     EXPECT_EQ("*", to);
     EXPECT_EQ("*", to);
     EXPECT_EQ(0, session.getMsgQueue()->size());
     EXPECT_EQ(0, session.getMsgQueue()->size());
 
 
-    // without explicit argument, the session should not automatically
+    // with this argument, the session should not automatically
     // subscribe to logging config
     // subscribe to logging config
     EXPECT_FALSE(session.haveSubscription("Logging", "*"));
     EXPECT_FALSE(session.haveSubscription("Logging", "*"));
 }
 }
 
 
 TEST_F(CCSessionTest, session2) {
 TEST_F(CCSessionTest, session2) {
     EXPECT_FALSE(session.haveSubscription("Spec2", "*"));
     EXPECT_FALSE(session.haveSubscription("Spec2", "*"));
-    ModuleCCSession mccs(ccspecfile("spec2.spec"), session, NULL, NULL);
+    ModuleCCSession mccs(ccspecfile("spec2.spec"), session, NULL, NULL,
+                         true, false);
     EXPECT_TRUE(session.haveSubscription("Spec2", "*"));
     EXPECT_TRUE(session.haveSubscription("Spec2", "*"));
 
 
     EXPECT_EQ(1, session.getMsgQueue()->size());
     EXPECT_EQ(1, session.getMsgQueue()->size());
@@ -217,7 +219,7 @@ TEST_F(CCSessionTest, session3) {
 
 
     EXPECT_FALSE(session.haveSubscription("Spec2", "*"));
     EXPECT_FALSE(session.haveSubscription("Spec2", "*"));
     ModuleCCSession mccs(ccspecfile("spec2.spec"), session, my_config_handler,
     ModuleCCSession mccs(ccspecfile("spec2.spec"), session, my_config_handler,
-                         my_command_handler);
+                         my_command_handler, true, false);
     EXPECT_TRUE(session.haveSubscription("Spec2", "*"));
     EXPECT_TRUE(session.haveSubscription("Spec2", "*"));
 
 
     EXPECT_EQ(2, session.getMsgQueue()->size());
     EXPECT_EQ(2, session.getMsgQueue()->size());
@@ -241,7 +243,7 @@ TEST_F(CCSessionTest, checkCommand) {
 
 
     EXPECT_FALSE(session.haveSubscription("Spec29", "*"));
     EXPECT_FALSE(session.haveSubscription("Spec29", "*"));
     ModuleCCSession mccs(ccspecfile("spec29.spec"), session, my_config_handler,
     ModuleCCSession mccs(ccspecfile("spec29.spec"), session, my_config_handler,
-                         my_command_handler);
+                         my_command_handler, true, false);
     EXPECT_TRUE(session.haveSubscription("Spec29", "*"));
     EXPECT_TRUE(session.haveSubscription("Spec29", "*"));
 
 
     EXPECT_EQ(2, session.getMsgQueue()->size());
     EXPECT_EQ(2, session.getMsgQueue()->size());
@@ -318,7 +320,7 @@ TEST_F(CCSessionTest, checkCommand2) {
     session.getMessages()->add(createAnswer(0, el("{}")));
     session.getMessages()->add(createAnswer(0, el("{}")));
     EXPECT_FALSE(session.haveSubscription("Spec29", "*"));
     EXPECT_FALSE(session.haveSubscription("Spec29", "*"));
     ModuleCCSession mccs(ccspecfile("spec29.spec"), session, my_config_handler,
     ModuleCCSession mccs(ccspecfile("spec29.spec"), session, my_config_handler,
-                         my_command_handler);
+                         my_command_handler, true, false);
     EXPECT_TRUE(session.haveSubscription("Spec29", "*"));
     EXPECT_TRUE(session.haveSubscription("Spec29", "*"));
     ConstElementPtr msg;
     ConstElementPtr msg;
     std::string group, to;
     std::string group, to;
@@ -370,7 +372,8 @@ TEST_F(CCSessionTest, remoteConfig) {
     std::string module_name;
     std::string module_name;
     int item1;
     int item1;
     
     
-    ModuleCCSession mccs(ccspecfile("spec1.spec"), session, NULL, NULL, false);
+    ModuleCCSession mccs(ccspecfile("spec1.spec"), session, NULL, NULL,
+                         false, false);
     EXPECT_TRUE(session.haveSubscription("Spec1", "*"));
     EXPECT_TRUE(session.haveSubscription("Spec1", "*"));
     
     
     // first simply connect, with no config values, and see we get
     // first simply connect, with no config values, and see we get
@@ -526,7 +529,7 @@ TEST_F(CCSessionTest, ignoreRemoteConfigCommands) {
 
 
     EXPECT_FALSE(session.haveSubscription("Spec29", "*"));
     EXPECT_FALSE(session.haveSubscription("Spec29", "*"));
     ModuleCCSession mccs(ccspecfile("spec29.spec"), session, my_config_handler,
     ModuleCCSession mccs(ccspecfile("spec29.spec"), session, my_config_handler,
-                         my_command_handler, false);
+                         my_command_handler, false, false);
     EXPECT_TRUE(session.haveSubscription("Spec29", "*"));
     EXPECT_TRUE(session.haveSubscription("Spec29", "*"));
 
 
     EXPECT_EQ(2, session.getMsgQueue()->size());
     EXPECT_EQ(2, session.getMsgQueue()->size());
@@ -578,14 +581,15 @@ TEST_F(CCSessionTest, initializationFail) {
 
 
 // Test it throws when we try to start it twice (once from the constructor)
 // Test it throws when we try to start it twice (once from the constructor)
 TEST_F(CCSessionTest, doubleStartImplicit) {
 TEST_F(CCSessionTest, doubleStartImplicit) {
-    ModuleCCSession mccs(ccspecfile("spec29.spec"), session, NULL, NULL);
+    ModuleCCSession mccs(ccspecfile("spec29.spec"), session, NULL, NULL,
+                         true, false);
     EXPECT_THROW(mccs.start(), CCSessionError);
     EXPECT_THROW(mccs.start(), CCSessionError);
 }
 }
 
 
 // The same, but both starts are explicit
 // The same, but both starts are explicit
 TEST_F(CCSessionTest, doubleStartExplicit) {
 TEST_F(CCSessionTest, doubleStartExplicit) {
     ModuleCCSession mccs(ccspecfile("spec29.spec"), session, NULL, NULL,
     ModuleCCSession mccs(ccspecfile("spec29.spec"), session, NULL, NULL,
-                         false);
+                         false, false);
     mccs.start();
     mccs.start();
     EXPECT_THROW(mccs.start(), CCSessionError);
     EXPECT_THROW(mccs.start(), CCSessionError);
 }
 }
@@ -593,7 +597,8 @@ TEST_F(CCSessionTest, doubleStartExplicit) {
 // Test we can request synchronous receive before we start the session,
 // Test we can request synchronous receive before we start the session,
 // and check there's the mechanism if we do it after
 // and check there's the mechanism if we do it after
 TEST_F(CCSessionTest, delayedStart) {
 TEST_F(CCSessionTest, delayedStart) {
-    ModuleCCSession mccs(ccspecfile("spec2.spec"), session, NULL, NULL, false);
+    ModuleCCSession mccs(ccspecfile("spec2.spec"), session, NULL, NULL,
+                         false, false);
     session.getMessages()->add(createAnswer());
     session.getMessages()->add(createAnswer());
     ConstElementPtr env, answer;
     ConstElementPtr env, answer;
     EXPECT_NO_THROW(session.group_recvmsg(env, answer, false, 3));
     EXPECT_NO_THROW(session.group_recvmsg(env, answer, false, 3));
@@ -620,7 +625,7 @@ TEST_F(CCSessionTest, loggingStartBadSpec) {
     // just give an empty config
     // just give an empty config
     session.getMessages()->add(createAnswer(0, el("{}")));
     session.getMessages()->add(createAnswer(0, el("{}")));
     EXPECT_THROW(new ModuleCCSession(ccspecfile("spec2.spec"), session,
     EXPECT_THROW(new ModuleCCSession(ccspecfile("spec2.spec"), session,
-                 NULL, NULL, true, true), ModuleSpecError);
+                 NULL, NULL), ModuleSpecError);
     EXPECT_FALSE(session.haveSubscription("Logging", "*"));
     EXPECT_FALSE(session.haveSubscription("Logging", "*"));
 }
 }
 
 
@@ -629,7 +634,8 @@ TEST_F(CCSessionTest, loggingStartBadSpec) {
 // if we need to call addRemoteConfig().
 // if we need to call addRemoteConfig().
 // The correct cases are covered in remoteConfig test.
 // The correct cases are covered in remoteConfig test.
 TEST_F(CCSessionTest, doubleStartWithAddRemoteConfig) {
 TEST_F(CCSessionTest, doubleStartWithAddRemoteConfig) {
-    ModuleCCSession mccs(ccspecfile("spec29.spec"), session, NULL, NULL);
+    ModuleCCSession mccs(ccspecfile("spec29.spec"), session, NULL, NULL,
+                         true, false);
     session.getMessages()->add(createAnswer(0, el("{}")));
     session.getMessages()->add(createAnswer(0, el("{}")));
     EXPECT_THROW(mccs.addRemoteConfig(ccspecfile("spec2.spec")),
     EXPECT_THROW(mccs.addRemoteConfig(ccspecfile("spec2.spec")),
                  FakeSession::DoubleRead);
                  FakeSession::DoubleRead);

+ 2 - 2
src/lib/python/isc/config/ccsession.py

@@ -142,7 +142,7 @@ class ModuleCCSession(ConfigData):
        callbacks are called when 'check_command' is called on the
        callbacks are called when 'check_command' is called on the
        ModuleCCSession"""
        ModuleCCSession"""
        
        
-    def __init__(self, spec_file_name, config_handler, command_handler, cc_session=None, handle_logging_config=False):
+    def __init__(self, spec_file_name, config_handler, command_handler, cc_session=None, handle_logging_config=True):
         """Initialize a ModuleCCSession. This does *NOT* send the
         """Initialize a ModuleCCSession. This does *NOT* send the
            specification and request the configuration yet. Use start()
            specification and request the configuration yet. Use start()
            for that once the ModuleCCSession has been initialized.
            for that once the ModuleCCSession has been initialized.
@@ -163,7 +163,7 @@ class ModuleCCSession(ConfigData):
            the logger manager to apply it. It will also inform the
            the logger manager to apply it. It will also inform the
            logger manager when the logging configuration gets updated.
            logger manager when the logging configuration gets updated.
            The module does not need to do anything except intializing
            The module does not need to do anything except intializing
-           its loggers, and provide log messages
+           its loggers, and provide log messages. Defaults to true.
         """
         """
         module_spec = isc.config.module_spec_from_file(spec_file_name)
         module_spec = isc.config.module_spec_from_file(spec_file_name)
         ConfigData.__init__(self, module_spec)
         ConfigData.__init__(self, module_spec)

+ 5 - 2
src/lib/python/isc/config/tests/ccsession_test.py

@@ -108,8 +108,11 @@ class TestModuleCCSession(unittest.TestCase):
     def spec_file(self, file):
     def spec_file(self, file):
         return self.data_path + os.sep + file
         return self.data_path + os.sep + file
         
         
-    def create_session(self, spec_file_name, config_handler = None, command_handler = None, cc_session = None):
-        return ModuleCCSession(self.spec_file(spec_file_name), config_handler, command_handler, cc_session)
+    def create_session(self, spec_file_name, config_handler = None,
+                       command_handler = None, cc_session = None):
+        return ModuleCCSession(self.spec_file(spec_file_name),
+                               config_handler, command_handler,
+                               cc_session, False)
 
 
     def test_init(self):
     def test_init(self):
         fake_session = FakeModuleCCSession()
         fake_session = FakeModuleCCSession()

+ 2 - 1
src/lib/server_common/tests/keyring_test.cc

@@ -38,7 +38,8 @@ public:
         specfile(std::string(TEST_DATA_PATH) + "/spec.spec")
         specfile(std::string(TEST_DATA_PATH) + "/spec.spec")
     {
     {
         session.getMessages()->add(createAnswer());
         session.getMessages()->add(createAnswer());
-        mccs.reset(new ModuleCCSession(specfile, session, NULL, NULL, false));
+        mccs.reset(new ModuleCCSession(specfile, session, NULL, NULL,
+                                       false, false));
     }
     }
     isc::cc::FakeSession session;
     isc::cc::FakeSession session;
     std::auto_ptr<ModuleCCSession> mccs;
     std::auto_ptr<ModuleCCSession> mccs;