Module: check_mk
Branch: master
Commit: 11c150c2fcac779fdd3418b9b07eb5ff4c692210
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=11c150c2fcac77…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Feb 28 11:00:17 2012 +0100
Fixed broken host validation
---
web/htdocs/wato.py | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index f3d747a..9be661b 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -1223,7 +1223,7 @@ def show_hosts(folder):
# Hostname with link to details page (edit host)
html.write('<td>')
- errors = host_errors.get(hostname,[]) + validate_host(hostname)
+ errors = host_errors.get(hostname,[]) + validate_host(host, g_folder)
if errors:
msg = _("Warning: This host has an invalid configuration: ")
msg += ", ".join(errors)
@@ -1798,7 +1798,7 @@ def mode_edithost(phase, new, cluster):
call_hook_hosts_changed(g_folder)
reload_hosts(g_folder)
- errors = validate_all_hosts([hostname]).get(hostname, []) +
validate_host(hostname)
+ errors = validate_all_hosts([hostname]).get(hostname, []) +
validate_host(host, g_folder)
if errors: # keep on this page if host does not validate
return
elif new:
@@ -1812,7 +1812,7 @@ def mode_edithost(phase, new, cluster):
if new:
render_folder_path()
else:
- errors = validate_all_hosts([hostname]).get(hostname, []) +
validate_host(hostname)
+ errors = validate_all_hosts([hostname]).get(hostname, []) +
validate_host(host, g_folder)
if errors:
html.write("<div class=info>")
@@ -4205,6 +4205,7 @@ def effective_attributes(host, folder):
chain = [ host ]
else:
chain = [ ]
+
while folder:
chain.append(folder.get("attributes", {}))
folder = folder.get(".parent")
@@ -9930,10 +9931,10 @@ def call_hook_roles_saved(roles):
# This hook is called in order to determine if a host has a 'valid'
# configuration. It used for displaying warning symbols in the
# host list and in the host detail view.
-def validate_host(host):
+def validate_host(host, folder):
if hook_registered('validate-host'):
errors = []
- eff = effective_attributes(host, host[".folder"])
+ eff = effective_attributes(host, folder)
for hk in g_hooks.get('validate-host', []):
try:
hk(eff)