Module: check_mk
Branch: master
Commit: e063aca6d9132e99604b6ea83bd89be18b7c1b3d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e063aca6d9132e…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Jun 5 12:25:39 2018 +0200
Removed __import__ Kung Fu and an import cycle.
Change-Id: I59403460d383f81fa305dd1ceab9f32bcd6f91e6
---
cmk_base/automations/check_mk.py | 8 +++++---
cmk_base/core_config.py | 9 ++++++---
cmk_base/utils.py | 10 ----------
3 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/cmk_base/automations/check_mk.py b/cmk_base/automations/check_mk.py
index a24f75a..f293056 100644
--- a/cmk_base/automations/check_mk.py
+++ b/cmk_base/automations/check_mk.py
@@ -765,9 +765,11 @@ class AutomationRestart(Automation):
try:
configuration_warnings = core_config.create_core_config()
- if cmk_base.utils.has_feature("cee.agent_bakery"):
- import cmk_base.cee.agent_bakery as agent_bakery
- agent_bakery.bake_on_restart()
+ try:
+ import cmk_base.cee.agent_bakery
+ cmk_base.cee.agent_bakery.bake_on_restart()
+ except ImportError:
+ pass
except Exception, e:
if backup_path:
diff --git a/cmk_base/core_config.py b/cmk_base/core_config.py
index 41ef541..4d8d812 100644
--- a/cmk_base/core_config.py
+++ b/cmk_base/core_config.py
@@ -230,9 +230,12 @@ def do_create_config(with_agents=True):
create_core_config()
console.output(tty.ok + "\n")
- if with_agents and cmk_base.utils.has_feature("cee.agent_bakery"):
- import cmk_base.cee.agent_bakery as agent_bakery
- agent_bakery.bake_on_restart()
+ if with_agents:
+ try:
+ import cmk_base.cee.agent_bakery
+ cmk_base.cee.agent_bakery.bake_on_restart()
+ except ImportError:
+ pass
def create_core_config():
diff --git a/cmk_base/utils.py b/cmk_base/utils.py
index 751907b..34801fa 100644
--- a/cmk_base/utils.py
+++ b/cmk_base/utils.py
@@ -175,16 +175,6 @@ def cleanup_globals():
cmk_base.snmp.cleanup_host_caches()
-def has_feature(name):
- try:
- __import__("cmk_base.%s" % name)
- return True
- except ImportError:
- return False
-
-
-
-
#.
# .--Ctrl-C--------------------------------------------------------------.
# | ____ _ _ ____ |