[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a

Gerhard Lausser gerhard.lausser at consol.de
Tue Feb 28 22:21:27 UTC 2012


The following commit has been merged in the debian/master branch:
commit 2b10a8d40ac87eefc43ca280da34e518551c8b3d
Author: Gerhard Lausser <gerhard.lausser at consol.de>
Date:   Fri Feb 17 01:17:28 2012 +0100

    Add livestatus attributes modified_attributes_list and a test case

diff --git a/shinken/external_command.py b/shinken/external_command.py
index 92bf22a..9a27630 100644
--- a/shinken/external_command.py
+++ b/shinken/external_command.py
@@ -639,7 +639,7 @@ class ExternalCommandManager:
         # If there were no regular checks (interval=0), then schedule
         # a check immediately.
         if old_interval == 0 and host.checks_enabled:
-            host.schedule(force=False, force_time=int(time.time())
+            host.schedule(force=False, force_time=int(time.time()))
         self.sched.get_and_register_status_brok(host)
 
     # CHANGE_NORMAL_SVC_CHECK_INTERVAL;<host_name>;<service_description>;<check_interval>
@@ -650,7 +650,7 @@ class ExternalCommandManager:
         # If there were no regular checks (interval=0), then schedule
         # a check immediately.
         if old_interval == 0 and service.checks_enabled:
-            service.schedule(force=False, force_time=int(time.time())
+            service.schedule(force=False, force_time=int(time.time()))
         self.sched.get_and_register_status_brok(service)
 
     # CHANGE_RETRY_HOST_CHECK_INTERVAL;<host_name>;<check_interval>
diff --git a/shinken/modules/livestatus_broker/mapping.py b/shinken/modules/livestatus_broker/mapping.py
index c6197fa..f346207 100644
--- a/shinken/modules/livestatus_broker/mapping.py
+++ b/shinken/modules/livestatus_broker/mapping.py
@@ -73,17 +73,10 @@ def modified_attributes_names(self):
         MODATTR_CUSTOM_VARIABLE: 'custom_variable',
         MODATTR_NOTIFICATION_TIMEPERIOD: 'notification_timeperiod',
     }
-    for attr in [MODATTR_NONE, MODATTR_NOTIFICATIONS_ENABLED
-, MODATTR_ACTIVE_CHECKS_ENABLED, MODATTR_PASSIVE_CHECKS_ENABLED, MODATTR_EVENT_H
-ANDLER_ENABLED, MODATTR_FLAP_DETECTION_ENABLED, MODATTR_FAILURE_PREDICTION_ENABL
-ED, MODATTR_PERFORMANCE_DATA_ENABLED, MODATTR_OBSESSIVE_HANDLER_ENABLED, MODATTR
-_EVENT_HANDLER_COMMAND, MODATTR_CHECK_COMMAND, MODATTR_NORMAL_CHECK_INTERVAL, MO
-DATTR_RETRY_CHECK_INTERVAL, MODATTR_MAX_CHECK_ATTEMPTS, MODATTR_FRESHNESS_CHECKS
-_ENABLED, MODATTR_CHECK_TIMEPERIOD, MODATTR_CUSTOM_VARIABLE, MODATTR_NOTIFICATIO
-N_TIMEPERIOD]:
+    for attr in [MODATTR_NONE, MODATTR_NOTIFICATIONS_ENABLED, MODATTR_ACTIVE_CHECKS_ENABLED, MODATTR_PASSIVE_CHECKS_ENABLED, MODATTR_EVENT_HANDLER_ENABLED, MODATTR_FLAP_DETECTION_ENABLED, MODATTR_FAILURE_PREDICTION_ENABLED, MODATTR_PERFORMANCE_DATA_ENABLED, MODATTR_OBSESSIVE_HANDLER_ENABLED, MODATTR_EVENT_HANDLER_COMMAND, MODATTR_CHECK_COMMAND, MODATTR_NORMAL_CHECK_INTERVAL, MODATTR_RETRY_CHECK_INTERVAL, MODATTR_MAX_CHECK_ATTEMPTS, MODATTR_FRESHNESS_CHECKS_ENABLED, MODATTR_CHECK_TIMEPERIOD, MODATTR_CUSTOM_VARIABLE, MODATTR_NOTIFICATION_TIMEPERIOD]:
         if self.modified_attributes & attr:
             names_list.append(names[attr])
-    return ','.join(names_list)
+    return names_list
 
 def join_with_separators(request, *args):
     if request.response.outputformat == 'csv':
@@ -509,12 +502,12 @@ livestatus_attribute_map = {
         },
         'modified_attributes': {
             'description': 'A bitmask specifying which attributes have been modified',
-            'function': lambda item, req: item.modified_attributes,  # CONTROLME INSORTME
+            'function': lambda item, req: item.modified_attributes,  # CONTROLME 
             'datatype': int,
         },
         'modified_attributes_list': {
             'description': 'A list of all modified attributes',
-            'function': lambda item, req: item.modified_attributes_list,  # CONTROLME
+            'function': lambda item, req: modified_attributes_names(self),  # CONTROLME
             'datatype': list,
         },
         'name': {
@@ -1347,12 +1340,12 @@ livestatus_attribute_map = {
         },
         'modified_attributes': {
             'description': 'A bitmask specifying which attributes have been modified',
-            'function': lambda item, req: item.modified_attributes,  # REPAIRME
+            'function': lambda item, req: item.modified_attributes,
             'datatype': int,
         },
         'modified_attributes_list': {
             'description': 'A list of all modified attributes',
-            'function': lambda item, req: item.modified_attributes_list,  # REPAIRME
+            'function': lambda item, req: modified_attributes_names(item),
             'datatype': list,
         },
         'next_check': {
@@ -1732,7 +1725,7 @@ livestatus_attribute_map = {
         },
         'modified_attributes_list': {
             'description': 'A list of all modified attributes',
-            'function': lambda item, req: item.modified_attributes_list,  # CONTROLME
+            'function': lambda item, req: modified_attributes_names(item),
             'datatype': list,
         },
         'name': {
diff --git a/test/test_livestatus.py b/test/test_livestatus.py
index c21cee7..723422f 100755
--- a/test/test_livestatus.py
+++ b/test/test_livestatus.py
@@ -650,13 +650,13 @@ Filter: host_state != 0
         self.update_broker()
         
         request = """GET services
-Columns: host_name description modified_attributes
+Columns: host_name description modified_attributes modified_attributes_list
 Filter: host_name = test_host_0
 Filter: description = test_ok_0
 """
         response, keepalive = self.livestatus_broker.livestatus.handle_request(request)
         print "response1", response
-        self.assert_(response == "test_host_0;test_ok_0;0\n")
+        self.assert_(response == "test_host_0;test_ok_0;0;\n")
 
         now = time.time()
         cmd = "[%lu] DISABLE_SVC_CHECK;test_host_0;test_ok_0" % now
@@ -666,7 +666,7 @@ Filter: description = test_ok_0
         self.update_broker()
         response, keepalive = self.livestatus_broker.livestatus.handle_request(request)
         print "response2", response
-        self.assert_(response == 'test_host_0;test_ok_0;2\n')
+        self.assert_(response == 'test_host_0;test_ok_0;2;active_checks_enabled\n')
         lssvc = self.livestatus_broker.datamgr.get_service("test_host_0", "test_ok_0")
         print "ma", lssvc.modified_attributes
         now = time.time()
@@ -676,11 +676,11 @@ Filter: description = test_ok_0
         self.scheduler_loop(2, [[host, 0, 'UP'], [svc, 0, 'OK']])
         self.update_broker()
         response, keepalive = self.livestatus_broker.livestatus.handle_request(request)
-        self.assert_(response == 'test_host_0;test_ok_0;3\n')
+        print "response3", response
+        self.assert_(response == 'test_host_0;test_ok_0;3;notifications_enabled,active_checks_enabled\n')
         print "ma", lssvc.modified_attributes
 
 
-
     def test_json(self):
         self.print_header()
         print "got initial broks"

-- 
UNNAMED PROJECT



More information about the Pkg-nagios-changes mailing list