Module: check_mk
Branch: master
Commit: e51767c611ae447fd204929f97c1f23663afc604
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e51767c611ae44…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jan 20 14:39:03 2012 +0100
Simplify hook implementation in WATO
---
web/htdocs/wato.py | 15 ++-------------
1 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index a0df5b0..a202235 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -6997,7 +6997,7 @@ def save_users(profiles):
os.remove(auth_file)
# Call the users_saved hook
- call_hook(call_hook_users_saved, users)
+ call_hook_users_saved(users)
# Dropdown for choosing a multisite user
class UserSelection(ElementSelection):
@@ -7337,7 +7337,7 @@ def save_roles(roles):
out.write("# Written by WATO\n# encoding: utf-8\n\n")
out.write("roles.update(\n%s)\n" % pprint.pformat(roles))
- call_hook(call_hook_roles_saved, roles)
+ call_hook_roles_saved(roles)
# Adapt references in users. Builtin rules cannot
@@ -9400,17 +9400,6 @@ def call_hooks(name, *args):
traceback.print_exception(t, v, tb, None, txt)
html.show_error("<h3>" + _("Error executing hook")
+ " %s #%d: %s</h3><pre>%s</pre>" % (name, n, e,
txt.getvalue()))
-# Call the hooks. This is executed at the places where to run the hooks
-# This includes exception handling with raising user errors on exceptions
-def call_hook(handler, *args):
- try:
- handler(*args)
- except Exception, e:
- if config.debug:
- raise
- else:
- raise MKUserError(None, "Error executing hooks: %s" % str(e))
-
def call_hook_hosts_changed(folder):
if "hosts-changed" in g_hooks:
hosts = collect_hosts(folder)