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

Gerhard Lausser gerhard.lausser at consol.de
Tue Feb 28 22:17:54 UTC 2012


The following commit has been merged in the debian/master branch:
commit 2ae041abf27cb13acdd7c5d13c81409e600bf224
Author: Gerhard Lausser <gerhard.lausser at consol.de>
Date:   Tue Jan 31 23:32:59 2012 +0100

    Fix a livestatus testcase which failed because of different behavior of the json module under different python versions

diff --git a/shinken/modules/livestatus_broker/livestatus_response.py b/shinken/modules/livestatus_broker/livestatus_response.py
index a39acc5..d8092b5 100644
--- a/shinken/modules/livestatus_broker/livestatus_response.py
+++ b/shinken/modules/livestatus_broker/livestatus_response.py
@@ -162,7 +162,7 @@ class LiveStatusResponse:
                             #print "FALLBACK: %s.%s" % (type(item), attribute)
                             value = getattr(item.__class__, attribute).im_func.default
                         else:
-                            value = ''
+                            value = u''
                     if isinstance(value, bool):
                         if value == True:
                             rows.append(1)
@@ -174,7 +174,7 @@ class LiveStatusResponse:
                         except UnicodeEncodeError:
                             rows.append(value.encode('utf-8', 'replace'))
                         except Exception:
-                            rows.append('')
+                            rows.append(u'')
                 lines.append(rows)
             if self.columnheaders == 'on':
                 if len(aliases) > 0:
@@ -184,7 +184,6 @@ class LiveStatusResponse:
             if self.outputformat == 'json':
                 self.output = json.dumps(lines, separators=(',', ':'))
             else:
-                print "type is ", type(self)
                 self.output = str(json.loads(json.dumps(lines, separators=(',', ':'))))
 
     def format_live_data_stats(self, result, columns, aliases):
diff --git a/test/test_livestatus.py b/test/test_livestatus.py
index 7e49c78..1f85a8d 100755
--- a/test/test_livestatus.py
+++ b/test/test_livestatus.py
@@ -386,13 +386,13 @@ ResponseHeader: off
         request = """GET services
 Columns: host_name wrdlbrmpft description 
 Filter: host_name = test_host_0
-OutputFormat: python
+OutputFormat: json
 KeepAlive: on
 ResponseHeader: off
 """
         response, keepalive = self.livestatus_broker.livestatus.handle_request(request)
         print response
-        good_response = """[[u'test_host_0', u'', u'test_ok_0']]
+        good_response = """[["test_host_0","","test_ok_0"]]
 """
         self.assert_(response == good_response)
 

-- 
UNNAMED PROJECT



More information about the Pkg-nagios-changes mailing list