Reviewed-By: Ramon Medeiros <ramonn(a)br.ibm.com>
On 04/29/2016 02:09 PM, Rodrigo Trujillo wrote:
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(a)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):
"""
--
Ramon Nunes Medeiros
Kimchi Developer
Linux Technology Center Brazil
IBM Systems & Technology Group
Phone : +55 19 2132 7878
ramonn(a)br.ibm.com