Module: check_mk
Branch: master
Commit: 51ec145e0e992036e43fa0f3a0b203240025af1c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=51ec145e0e9920…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Dec 16 17:32:49 2013 +0100
FIX Avoid rare exception in WATO when deleting a host
When deleting a host in an environment with distributed WATO under
circumstances that are unclear an exception could happen in a function called
<tt>find_host_sites</tt>. This exception is now handled correctly.
---
.werks/341 | 12 ++++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 11 ++++++-----
3 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/.werks/341 b/.werks/341
new file mode 100644
index 0000000..6d35008
--- /dev/null
+++ b/.werks/341
@@ -0,0 +1,12 @@
+Title: Avoid rare exception in WATO when deleting a host
+Level: 1
+Component: wato
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1387211472
+Targetversion: future
+
+When deleting a host in an environment with distributed WATO under
+circumstances that are unclear an exception could happen in a function called
+<tt>find_host_sites</tt>. This exception is now handled correctly.
diff --git a/ChangeLog b/ChangeLog
index 3ac4b1d..58b5949 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -60,6 +60,7 @@
* 0331 FIX: LDAP diagnostic LOG can now have the $OMD_SITE$ macro configured via
WATO...
* 0332 FIX: Own host tag groups without topics resulted in two groups "Host
tags" in the rule editor
* 0361 FIX: The page linked by "new rule" can now be bookmarked again
+ * 0341 FIX: Avoid rare exception in WATO when deleting a host...
Notifications:
* 0362 sms: now searching PATH for sendsms and smssend commands...
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 77cd9e8..4414320 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -8222,11 +8222,12 @@ def global_replication_state():
return "clean"
def find_host_sites(site_ids, folder, hostname):
- host = folder[".hosts"][hostname]
- if "site" in host and host["site"]:
- site_ids.add(host["site"])
- elif folder[".siteid"]:
- site_ids.add(folder[".siteid"])
+ if hostname in folder[".hosts"]:
+ host = folder[".hosts"][hostname]
+ if "site" in host and host["site"]:
+ site_ids.add(host["site"])
+ elif folder[".siteid"]:
+ site_ids.add(folder[".siteid"])
# Scan recursively for references to sites
# in folders and hosts