Module: check_mk
Branch: master
Commit: e353482f0773a8ee0b71d490e4fadf4c83616995
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e353482f0773a8…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Feb 15 08:13:15 2017 +0100
4366 FIX Fixed random exception related to html.unplug() in GUI
Change-Id: Ic794a9861fcf05193f27ec0e3ff5477ee8292d65
---
.werks/4366 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/htmllib.py | 27 ++++++++++++++++-----------
3 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/.werks/4366 b/.werks/4366
new file mode 100644
index 0000000..cdf871d
--- /dev/null
+++ b/.werks/4366
@@ -0,0 +1,10 @@
+Title: Fixed random exception related to html.unplug() in GUI
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.5.0i1
+Date: 1487142764
+
+
diff --git a/ChangeLog b/ChangeLog
index 1d1ef1d..fdb2954 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@
Multisite:
* 4365 FIX: Service availability: Host down could not be rewritten to other states
like CRIT
+ * 4366 FIX: Fixed random exception related to html.unplug() in GUI
1.4.0b1:
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 6c97fa9..535f391 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -361,25 +361,30 @@ class OutputFunnel(object):
# Pull the plug for a moment to allow the sink content to pass through.
def flush(self):
- if self.is_plugged():
- text = self.plug_text[self.plug_level]
- self.plug_text[self.plug_level] = ""
- self.plug_level -= 1
- self.write(text)
- self.plug_level += 1
+ if not self.is_plugged():
+ return None
+
+ text = self.plug_text[self.plug_level]
+ self.plug_text[self.plug_level] = ""
+ self.plug_level -= 1
+ self.write(text)
+ self.plug_level += 1
# Get the sink content in order to do something with it.
def drain(self):
- if self.is_plugged():
- text = self.plug_text[self.plug_level]
- self.plug_text[self.plug_level] = ''
- return text
- else:
+ if not self.is_plugged():
return ''
+ text = self.plug_text[self.plug_level]
+ self.plug_text[self.plug_level] = ''
+ return text
+
def unplug(self):
+ if not self.is_plugged():
+ return
+
self.flush()
self.plug_text.pop()
self.plug_level -= 1