[Kimchi-devel] [PATCH][Wok] Sort user request log output

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Fri Apr 29 17:09:39 UTC 2016


There is an issue in user request log output when you have backup files
in your system. The values from backup logs are included in the return
list and showed before latest events. Then user has to use UI sort
buttons in order to see what is happening.
This patch sorts the output, ensuring that latest events will be
returned on 'top' of the list and be showed firstly in the UI.

Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
---
 src/wok/reqlogger.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/wok/reqlogger.py b/src/wok/reqlogger.py
index 1294be1..1145dbd 100644
--- a/src/wok/reqlogger.py
+++ b/src/wok/reqlogger.py
@@ -105,7 +105,9 @@ class RequestParser(object):
             filename = ".".join([self.baseFile, str(count + 1)])
             records.extend(self.getRecordsFromFile(filename))
 
-        return records
+        # Return ordered by latest events first
+        return sorted(records, key=lambda k: k['date'] + k['time'],
+                      reverse=True)
 
     def getRecordsFromFile(self, filename):
         """
-- 
2.1.0




More information about the Kimchi-devel mailing list