Module: check_mk
Branch: master
Commit: 6d68e491418b7c008679029c4eff4bf6864e394d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6d68e491418b7c…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Fri Jun 15 08:37:25 2018 +0200
Moved function to right place
Change-Id: I2a6a14cb4dabd176da956afbd2f0de5c93834d91
---
cmk_base/checking.py | 18 ++----------------
cmk_base/inventory.py | 14 ++++++++++++++
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/cmk_base/checking.py b/cmk_base/checking.py
index 815af7b..3be2336 100644
--- a/cmk_base/checking.py
+++ b/cmk_base/checking.py
@@ -205,27 +205,13 @@ def _do_all_checks_on_host(sources, hostname, ipaddress,
only_check_plugin_names
missing_sections.add(cmk_base.check_utils.section_name_of(check_plugin_name))
if checks.do_status_data_inventory_for(hostname):
- _do_status_data_inventory(sources, multi_host_sections, hostname, ipaddress)
+ import cmk_base.inventory as inventory
+ inventory.do_status_data_inventory(sources, multi_host_sections, hostname,
ipaddress)
missing_section_list = sorted(list(missing_sections))
return num_success, missing_section_list
-def _do_status_data_inventory(sources, multi_host_sections, hostname, ipaddress):
- import cmk_base.inventory as inventory
- import cmk_base.inventory_plugins as inventory_plugins
- # cmk_base/modes/check_mk.py loads check plugins but not inventory plugins
- do_inv = False
- inventory_plugins.load_plugins(inventory.get_inventory_context)
- for plugin in inventory_plugins.inv_info.values():
- if plugin.get("has_status_data"):
- do_inv = True
- break
- if do_inv:
- inventory.do_inv_for(sources, multi_host_sections=multi_host_sections,
hostname=hostname,
- ipaddress=ipaddress, do_status_data_inventory=True)
-
-
def execute_check(multi_host_sections, hostname, ipaddress, check_plugin_name, item,
params, description):
# Make a bit of context information globally available, so that functions
# called by checks now this context
diff --git a/cmk_base/inventory.py b/cmk_base/inventory.py
index 47997ce..4719444 100644
--- a/cmk_base/inventory.py
+++ b/cmk_base/inventory.py
@@ -154,6 +154,20 @@ def do_inv_check(hostname, options):
return status, infotexts, long_infotexts, perfdata
+def do_status_data_inventory(sources, multi_host_sections, hostname, ipaddress):
+ import cmk_base.inventory_plugins as inventory_plugins
+ # cmk_base/modes/check_mk.py loads check plugins but not inventory plugins
+ do_inv = False
+ inventory_plugins.load_plugins(get_inventory_context)
+ for plugin in inventory_plugins.inv_info.values():
+ if plugin.get("has_status_data"):
+ do_inv = True
+ break
+ if do_inv:
+ do_inv_for(sources, multi_host_sections=multi_host_sections, hostname=hostname,
+ ipaddress=ipaddress, do_status_data_inventory=True)
+
+
def do_inv_for(sources, multi_host_sections, hostname, ipaddress,
do_status_data_inventory=False):
_initialize_inventory_tree()
inventory_tree = g_inv_tree