Module: check_mk
Branch: master
Commit: 26e57854fb68b9db8a7c7dc5840e8cb20596a462
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=26e57854fb68b9…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Apr 7 16:43:45 2016 +0200
3374 FIX Fixed broken Logwatch page when a host has no log directory (yet)
---
.werks/3374 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/logwatch.py | 15 +++++++++------
3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/.werks/3374 b/.werks/3374
new file mode 100644
index 0000000..79df35d
--- /dev/null
+++ b/.werks/3374
@@ -0,0 +1,10 @@
+Title: Fixed broken Logwatch page when a host has no log directory (yet)
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1460040199
+
+
diff --git a/ChangeLog b/ChangeLog
index 0b56b60..555a0e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -180,6 +180,7 @@
* 3326 FIX: Fixed white text on white background in mobile GUI
* 3327 FIX: Disallow scheduling downtimes with an end date that is before the start
date
* 3373 FIX: Fixed exception when handling syntax errors while loading pagetype files
+ * 3374 FIX: Fixed broken Logwatch page when a host has no log directory (yet)
WATO:
* 3244 WATO BI Module: swap order of aggregation function and child node
selection...
diff --git a/web/htdocs/logwatch.py b/web/htdocs/logwatch.py
index 00870ef..73cbec9 100644
--- a/web/htdocs/logwatch.py
+++ b/web/htdocs/logwatch.py
@@ -54,13 +54,14 @@ def level_state(level):
# '----------------------------------------------------------------------'
def page_show():
- host = html.var('host')
- filename = html.var('file')
- if "/" in host:
- return
+ host = html.var("host", "")
+ filename = html.var("file", "")
# Fix problem when URL is missing certain illegal characters
- filename = form_file_to_ext(find_matching_logfile(host, form_file_to_int(filename)))
+ try:
+ filename = form_file_to_ext(find_matching_logfile(host,
form_file_to_int(filename)))
+ except OSError:
+ pass # host log dir does not exist
# Acknowledging logs is supported on
# a) all logs on all hosts
@@ -153,7 +154,9 @@ def list_logs(host, logfiles):
(form_datetime(last_log['datetime']), len(logs)))
if rowno == 0:
- html.write('<tr><td class="data"
colspan=4>'+_('No logs found for this
host.')+'</td></tr>\n')
+ html.write('<tr><td class="data" colspan=4>')
+ html.message(_('No logs found for this host.'))
+ html.write('</td></tr>\n')
def ack_button(host = None, int_filename = None):