Module: check_mk
Branch: master
Commit: f23a036a88e94022dc7c98eb222068e45020c980
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f23a036a88e940…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jul 17 13:36:20 2015 +0200
#2470 FIX Fixed exception in logwatch log list in rare cases
When logfiles for a host exists which have only a log section header
without related log lines, this could lead to an exception in the GUI
when listing all existing logs.
---
.werks/2470 | 12 ++++++++++++
ChangeLog | 3 ++-
web/htdocs/logwatch.py | 8 ++++----
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/.werks/2470 b/.werks/2470
new file mode 100644
index 0000000..e75175a
--- /dev/null
+++ b/.werks/2470
@@ -0,0 +1,12 @@
+Title: Fixed exception in logwatch log list in rare cases
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1437132921
+
+When logfiles for a host exists which have only a log section header
+without related log lines, this could lead to an exception in the GUI
+when listing all existing logs.
diff --git a/ChangeLog b/ChangeLog
index 6ef63ed..5f983df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -58,8 +58,8 @@
* 2403 FIX: ibm_imm_fan: fixed exception with invalid formatted fan speed
information...
* 2404 FIX: apache_status: now able to handle BusyServers and IdleServers...
* 2406 FIX: fileinfo: fixed missing size performance data for very large (e.g 2TB)
files and fileinfo groups...
- * 2408 FIX: ibm_imm_fan: fixed exception while parsing fan percentage values
* 2450 FIX: citrix_serverload: Changed representation of load to percent in rule and
graphs, added perfometer
+ * 2408 FIX: ibm_imm_fan: fixed exception while parsing fan percentage values
* 2469 FIX: Fixed service discovery on SNMP host having no system description OID
Multisite:
@@ -81,6 +81,7 @@
* 2396 FIX: LDAP: Fixed handling of LDAP trees having special chars in the path (e.g.
in OU names)...
* 2459 FIX: Preventing caching of all HTTP requests to dynamic pages (*.py)...
* 2468 FIX: Fixed actions for duplicate host names on different sites...
+ * 2470 FIX: Fixed exception in logwatch log list in rare cases...
WATO:
* 2365 Removed old deprecated notification global options for plain emails...
diff --git a/web/htdocs/logwatch.py b/web/htdocs/logwatch.py
index bd451ed..80af138 100644
--- a/web/htdocs/logwatch.py
+++ b/web/htdocs/logwatch.py
@@ -131,7 +131,7 @@ def list_logs(host, logfiles):
logs = parse_file(host, log_file)
if logs == [] or type(logs) != list: # corrupted logfile
if logs == []: logs = "empty"
- html.write("<tr class=%s0>\n" % (rowno % 2 == 0 and
"odd" or "even"))
+ html.write("<tr class=\"data %s0\">\n" % (rowno % 2
== 0 and "odd" or "even"))
html.write("<td>-</td><td>%s</td><td>%s</td><td>0</td></tr>\n"
%
(html.attrencode(logs), html.attrencode(file_display)))
else:
@@ -139,7 +139,7 @@ def list_logs(host, logfiles):
last_log = get_last_log(logs)
state = worst_log['level']
state_name = form_level(state)
- html.write("<tr class=%s%d>\n" % (rowno % 2 == 0 and
"odd" or "even", state))
+ html.write("<tr class=\"data %s%d\">\n" % (rowno %
2 == 0 and "odd" or "even", state))
html.write("<td class=\"state%d\">%s</td>\n"
% (state, state_name))
html.write("<td><a
href=\"%s\">%s</a></td>\n" %
@@ -148,7 +148,7 @@ def list_logs(host, logfiles):
(form_datetime(last_log['datetime']), len(logs)))
if rowno == 0:
- html.write('<tr><td colspan=4>'+_('No logs found for this
host.')+'</td></tr>\n')
+ html.write('<tr><td class="data"
colspan=4>'+_('No logs found for this
host.')+'</td></tr>\n')
def ack_button(host = None, int_filename = None):
@@ -292,7 +292,7 @@ def do_log_ack(host, filename):
def get_worst_log(logs):
worst_level = 0
- worst_log = None
+ worst_log = logs[0]
for log in logs:
for line in log['lines']: