[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a
Gerhard Lausser
gerhard.lausser at consol.de
Tue Feb 28 22:15:37 UTC 2012
The following commit has been merged in the debian/master branch:
commit 5f7195aa3e4fb932c0982c8300b8cdf4e85b60a2
Author: Gerhard Lausser <gerhard.lausser at consol.de>
Date: Sun Jan 22 14:19:47 2012 +0100
Fix a bug in the fallback-if-no-separate-logstore-module-routine
diff --git a/shinken/modules/livestatus_broker/livestatus_broker.py b/shinken/modules/livestatus_broker/livestatus_broker.py
index 9f847e3..83608be 100644
--- a/shinken/modules/livestatus_broker/livestatus_broker.py
+++ b/shinken/modules/livestatus_broker/livestatus_broker.py
@@ -80,6 +80,8 @@ class LiveStatus_broker(BaseModule, Daemon):
self.debug = getattr(modconf, 'debug', None)
self.debug_queries = (getattr(modconf, 'debug_queries', '0') == '1')
+ # This is an "artificial" module which is used when an old-style
+ # shinken-specific.cfg without a separate logstore-module is found.
self.compat_sqlite = {
'module_name': 'LogStore',
'module_type': 'logstore_sqlite',
@@ -98,10 +100,7 @@ class LiveStatus_broker(BaseModule, Daemon):
dbmod = Module(self.compat_sqlite)
self.modules_manager.set_modules([dbmod])
self.modules_manager.load_and_init()
-
-
-
-
+ self.modules_manager.instances[0].load(self)
# Called by Broker so we can do init stuff
# TODO : add conf param to get pass with init
diff --git a/test/test_livestatus_db.py b/test/test_livestatus_db.py
index 25e4e3f..5150a42 100755
--- a/test/test_livestatus_db.py
+++ b/test/test_livestatus_db.py
@@ -699,19 +699,20 @@ class TestConfigNoLogstore(TestConfig):
def init_livestatus(self):
self.livelogs = 'tmp/livelogs.db' + self.testid
modconf = Module({'module_name' : 'LiveStatus',
- 'module_type' : 'livestatus',
- 'port' : str(50000 + os.getpid()),
- 'pnp_path' : 'tmp/pnp4nagios_test' + self.testid,
- 'host' : '127.0.0.1',
- 'socket' : 'live',
- 'name' : 'test', #?
+ 'module_type': 'livestatus',
+ 'port': str(50000 + os.getpid()),
+ 'pnp_path': 'tmp/pnp4nagios_test' + self.testid,
+ 'host': '127.0.0.1',
+ 'socket': 'live',
+ 'name': 'test', #?
+ 'database_file': self.livelogs,
})
dbmodconf = Module({'module_name' : 'LogStore',
- 'module_type' : 'logstore_sqlite',
- 'use_aggressive_sql' : "0",
- 'database_file' : self.livelogs,
- 'archive_path' : os.path.join(os.path.dirname(self.livelogs), 'archives'),
+ 'module_type': 'logstore_sqlite',
+ 'use_aggressive_sql': "0",
+ 'database_file': self.livelogs,
+ 'archive_path': os.path.join(os.path.dirname(self.livelogs), 'archives'),
})
####################################
# !NOT! modconf.modules = [dbmodconf]
@@ -719,6 +720,8 @@ class TestConfigNoLogstore(TestConfig):
self.livestatus_broker = LiveStatus_broker(modconf)
self.livestatus_broker.create_queues()
+ self.livestatus_broker.init()
+
#--- livestatus_broker.main
self.livestatus_broker.log = logger
# this seems to damage the logger so that the scheduler can't use it
@@ -743,17 +746,20 @@ class TestConfigNoLogstore(TestConfig):
datamgr.load(self.livestatus_broker.rg)
#--- livestatus_broker.main
- self.livestatus_broker.init()
- self.livestatus_broker.db = self.livestatus_broker.modules_manager.instances[0]
- self.livestatus_broker.livestatus = LiveStatus(self.livestatus_broker.datamgr, self.livestatus_broker.db, self.livestatus_broker.pnp_path, self.livestatus_broker.from_q)
-
#--- livestatus_broker.do_main
+ self.livestatus_broker.db = self.livestatus_broker.modules_manager.instances[0]
self.livestatus_broker.db.open()
#--- livestatus_broker.do_main
+ #--- livestatus_broker.manage_lql_thread
+ self.livestatus_broker.livestatus = LiveStatus(self.livestatus_broker.datamgr, self.livestatus_broker.db, self.livestatus_broker.pnp_path, self.livestatus_broker.from_q)
+ #--- livestatus_broker.manage_lql_thread
+
+
def test_has_implicit_module(self):
self.assert_(self.livestatus_broker.modules_manager.instances[0].properties['type'] == 'logstore_sqlite')
self.assert_(self.livestatus_broker.modules_manager.instances[0].__class__.__name__ == 'LiveStatusLogStoreSqlite')
+ self.assert_(self.livestatus_broker.db.database_file == self.livelogs)
if __name__ == '__main__':
--
UNNAMED PROJECT
More information about the Pkg-nagios-changes
mailing list