Module: check_mk
Branch: master
Commit: cf3d3130896b5e93cae200ece3cba388fa782ea0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cf3d3130896b5e…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu May 7 14:35:49 2015 +0200
The bulk service discovery raised an exception when some of the hosts failed
during the discovery and the folders of these hosts were locked with the option
<tt>_lock</tt>.
This has been fixed.
---
.werks/2263 | 13 +++++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 9 +++++----
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/.werks/2263 b/.werks/2263
new file mode 100644
index 0000000..a7a9432
--- /dev/null
+++ b/.werks/2263
@@ -0,0 +1,13 @@
+Title: Bulk service discovery: Fixed error when doing bulk inventory on locked folders
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1431001927
+
+The bulk service discovery raised an exception when some of the hosts failed
+during the discovery and the folders of these hosts were locked with the option
<tt>_lock</tt>.
+This has been fixed.
+
diff --git a/ChangeLog b/ChangeLog
index c70a930..a642624 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -480,6 +480,7 @@
* 2178 FIX: Fixed handling of user erros in WATO when using Python < 2.5
* 2203 FIX: Fix sorting of unselected elements in a list choice with two panes
* 2244 FIX: Fixed sorting of host tag topics in dropdown selections
+ * 2263 FIX: Bulk service discovery: Fixed error when doing bulk inventory on locked
folders...
Notifications:
* 1662 notification plugin spectrum: finalized script. now able to handle host
notications
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 8d50384..932b5a4 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -3743,7 +3743,7 @@ def mode_bulk_inventory(phase):
host = folder[".hosts"][hostname]
if hostname in failed_hosts:
result_txt += _("Failed to inventorize %s:
%s<br>") % (hostname, failed_hosts[hostname])
- if not host.get("inventory_failed"):
+ if not host.get("inventory_failed") and not
hosts.get(".folder", {}).get("_lock_hosts"):
host["inventory_failed"] = True
save_hosts(folder)
else:
@@ -3752,7 +3752,8 @@ def mode_bulk_inventory(phase):
log_pending(AFFECTED, hostname, "bulk-inventory",
_("Inventorized host: %d added, %d removed, %d kept, %d
total services") %
tuple(counts[hostname]))
- if "inventory_failed" in host:
+
+ if "inventory_failed" in hostand not
hosts.get(".folder", {}).get("_lock_hosts"):
del host["inventory_failed"]
save_hosts(folder) # Could be optimized, but difficult here
@@ -18174,12 +18175,12 @@ class API:
host = all_hosts[hostname]
counts, failed_hosts = check_mk_automation(host[".siteid"],
"inventory", [ "@scan", mode ] + [hostname])
if failed_hosts:
- if not host.get("inventory_failed"):
+ if not host.get("inventory_failed") and not
host.get(".folder", {}).get(".lock_hosts"):
host["inventory_failed"] = True
save_hosts(host[".folder"])
raise MKUserError(None, _("Failed to inventorize %s: %s") %
(hostname, failed_hosts[hostname]))
- if host.get("inventory_failed"):
+ if host.get("inventory_failed") and not host.get(".folder",
{}).get(".lock_hosts"):
del host["inventory_failed"]
save_hosts(host[".folder"])