Module: check_mk
Branch: master
Commit: 36c2e1137116168dad58bfea87a42fbd75dfb5fc
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=36c2e113711616…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue May 23 12:03:35 2017 +0200
Cleaned up watolib plugin loading a bit. A lot more needs to be done in 1.5 code
Change-Id: I2d4fca04bf5b8090b4c8b0175e8c285c9e9bb9a0
---
web/htdocs/wato.py | 8 +++++++-
web/htdocs/watolib.py | 16 +++++++---------
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 59a014d..5de5ee3 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -17354,7 +17354,13 @@ def load_plugins(force):
load_notification_table()
initialize_global_configvars()
- initialize_before_loading_plugins()
+ # Initialize watolib things which are needed before loading the WATO plugins.
+ # This also loads the watolib plugins. Then the globals of the watolib.py are
+ # loaded into the wato.py namespace. This "repeats" the watolib star import
above
+ # together with things from the plugins. What a hack!
+ # TODO: Clearly separate the watolib and wato
+ globals().update(load_watolib_plugins())
+
register_builtin_host_tags()
# Declare WATO-specific permissions
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 9fb3ee5..4a022d1 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -87,7 +87,7 @@ g_host_attributes = []
# Dictionary for quick access
g_host_attribute = {}
-def initialize_before_loading_plugins():
+def load_watolib_plugins():
if g_rulespecs:
g_rulespecs.clear()
@@ -128,6 +128,10 @@ def initialize_before_loading_plugins():
backup_domains.clear()
+ load_web_plugins("watolib", globals())
+ return globals()
+
+
def init_watolib_datastructures():
if config.wato_use_git:
prepare_git_commit()
@@ -2489,14 +2493,8 @@ class CREHost(WithPermissionsAndAttributes):
self._name = new_name
-
-if cmk.is_managed_edition():
- # TODO: Hack that is needed to resolve circular imports. This will be cleaned up in
1.5 code
- # soon. For the 1.4. we need to stick with this hack. Sorry.
- execfile("%s/plugins/watolib/managed_watolib.py" % cmk.paths.web_dir)
-else:
- Folder = CREFolder
- Host = CREHost
+Folder = CREFolder
+Host = CREHost
#.
# .--Attributes----------------------------------------------------------.