Module: check_mk
Branch: master
Commit: 1dc69d1bada573f9e32e1de465ad22a8cf01b6ad
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1dc69d1bada573…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Mar 7 13:23:42 2018 +0100
5770 FIX HW/SW/-Inventory service: Displayed wrong amount of entries by using wrong data
source
Change-Id: I58e6b8945e73f62640ec0419555e5d51db8f07fd
---
.werks/5770 | 10 ++++++++++
cmk_base/data_sources/abstract.py | 5 ++++-
cmk_base/inventory.py | 1 +
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/.werks/5770 b/.werks/5770
new file mode 100644
index 0000000..4a2630c
--- /dev/null
+++ b/.werks/5770
@@ -0,0 +1,10 @@
+Title: HW/SW/-Inventory service: Displayed wrong amount of entries by using wrong data
source
+Level: 1
+Component: inv
+Compatible: compat
+Edition: cre
+Version: 1.5.0i4
+Date: 1520425022
+Class: fix
+
+
diff --git a/cmk_base/data_sources/abstract.py b/cmk_base/data_sources/abstract.py
index 605b979..fc1777d 100644
--- a/cmk_base/data_sources/abstract.py
+++ b/cmk_base/data_sources/abstract.py
@@ -55,7 +55,10 @@ class DataSource(object):
# a single DataSources() object during processing first. Then we
# can change these class attributes to object attributes.
#
- # Set by the user via command line to prevent using cached information at all
+ # Set by the user via command line to prevent using cached information at all.
+ # Is also set by inventory for SNMP checks to handle the special situation that
+ # the inventory is not allowed to use the regular checking based SNMP data source
+ # cache.
_no_cache = False
# Set by the code in different situations where we recommend, but not enforce,
# to use the cache. The user can always use "--cache" to override this.
diff --git a/cmk_base/inventory.py b/cmk_base/inventory.py
index b3e1e01..70eedf9 100644
--- a/cmk_base/inventory.py
+++ b/cmk_base/inventory.py
@@ -215,6 +215,7 @@ def _do_inv_for_realhost(hostname, ipaddress, inventory_tree,
status_data_tree):
if isinstance(source, data_sources.SNMPDataSource):
source.set_on_error("raise")
source.set_do_snmp_scan(True)
+ source.disable_data_source_cache()
source.set_use_snmpwalk_cache(False)
source.set_ignore_check_interval(True)
source.set_check_plugin_name_filter(_gather_snmp_check_plugin_names_inventory)