Module: check_mk
Branch: master
Commit: 84c80c78da61c024a43909f12063df97855c568e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=84c80c78da61c0…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Sep 1 13:06:58 2017 +0200
omd: Hooks can be marked as deprecated. These will be hidden from output and menus then
Change-Id: I02a0d2d866ec3be21cef20ede54c6475556ad657
---
omd/packages/dokuwiki/DOKUWIKI_AUTH.hook | 1 +
omd/packages/omd/omd | 11 ++++++++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/omd/packages/dokuwiki/DOKUWIKI_AUTH.hook
b/omd/packages/dokuwiki/DOKUWIKI_AUTH.hook
index 738190f..9bc5166 100755
--- a/omd/packages/dokuwiki/DOKUWIKI_AUTH.hook
+++ b/omd/packages/dokuwiki/DOKUWIKI_AUTH.hook
@@ -2,6 +2,7 @@
# Alias: Deprecated - Use Dokuwiki for user management
# Menu: Web GUI
+# Deprecated: yes
# Description:
# In previous versions the Dokuwiki user database could be used as user database
# for all OMD components. This was never working correctly and was rarely used.
diff --git a/omd/packages/omd/omd b/omd/packages/omd/omd
index cbf591f..00bd200 100644
--- a/omd/packages/omd/omd
+++ b/omd/packages/omd/omd
@@ -1851,7 +1851,10 @@ def load_config_hooks():
load_hook_dependencies()
def config_load_hook(hook_name):
- hook = { "name" : hook_name }
+ hook = {
+ "name" : hook_name,
+ "deprecated" : False,
+ }
description = ""
description_active = False
@@ -1860,6 +1863,8 @@ def config_load_hook(hook_name):
hook["alias"] = line[8:].strip()
elif line.startswith("# Menu:"):
hook["menu"] = line[7:].strip()
+ elif line.startswith("# Deprecated: yes"):
+ hook["deprecated"] = True
elif line.startswith("# Description:"):
description_active = True
elif line.startswith("# ") and description_active:
@@ -2080,7 +2085,7 @@ def config_show(args):
hook_names.sort()
for hook_name in hook_names:
hook = g_config_hooks[hook_name]
- if hook["active"]:
+ if hook["active"] and not hook["deprecated"]:
sys.stdout.write("%s: %s\n" % (hook_name,
g_site_conf[hook_name]))
else:
output = []
@@ -2111,7 +2116,7 @@ def config_configure():
menu = {}
for hook_name in hook_names:
hook = g_config_hooks[hook_name]
- if hook["active"]:
+ if hook["active"] and not hook["deprecated"]:
mp = hook.get("menu", "Other")
entries = menu.get(mp, [])
entries.append((hook_name, g_site_conf[hook_name]))