Module: check_mk
Branch: master
Commit: e8abf8b1ffab58040dbf142a1d1a82efc3b1e61f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e8abf8b1ffab58…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Aug 28 15:32:44 2018 +0200
6456 FIX IPMI Management board: Fixed "cmk -d" on hosts with enabled mgmt board
An exception occurred on hosts having IPMI management board enabled when executing
"cmk -d [hostname]" on the console:
C+:
OMD[stable]:~$ cmk --debug -d ipmi-host
Traceback (most recent call last):
File "/omd/sites/stable/bin/cmk", line 96, in <module>
exit_status = modes.call(o, a, opts, args)
File "/omd/sites/stable/lib/python/cmk_base/modes/__init__.py", line 80, in
call
return mode.handler_function(*handler_args)
File "/omd/sites/stable/lib/python/cmk_base/modes/check_mk.py", line 366, in
mode_dump_agent
source_state, source_output, source_perfdata = source.get_summary_result()
File "/omd/sites/stable/lib/python/cmk_base/data_sources/abstract.py", line
392, in get_summary_result
return self._summary_result()
File "/omd/sites/stable/lib/python/cmk_base/data_sources/ipmi.py", line 152,
in _summary_result
return 0, "Version: %s" % self._get_ipmi_version(), []
File "/omd/sites/stable/lib/python/cmk_base/data_sources/ipmi.py", line 156,
in _get_ipmi_version
section = self._host_sections.sections.get("mgmt_ipmi_firmware")
AttributeError: 'NoneType' object has no attribute 'sections'
C-:
FEED-931
Change-Id: Id6d76ddc578c62d3ae384c68b70ae15dc034446e
---
.werks/6456 | 30 ++++++++++++++++++++++++++++++
cmk_base/data_sources/abstract.py | 10 +++++-----
cmk_base/data_sources/ipmi.py | 3 +++
3 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/.werks/6456 b/.werks/6456
new file mode 100644
index 0000000..745acec
--- /dev/null
+++ b/.werks/6456
@@ -0,0 +1,30 @@
+Title: IPMI Management board: Fixed "cmk -d" on hosts with enabled mgmt board
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1535462867
+
+An exception occurred on hosts having IPMI management board enabled when executing
+"cmk -d [hostname]" on the console:
+
+C+:
+OMD[stable]:~$ cmk --debug -d ipmi-host
+Traceback (most recent call last):
+ File "/omd/sites/stable/bin/cmk", line 96, in <module>
+ exit_status = modes.call(o, a, opts, args)
+ File "/omd/sites/stable/lib/python/cmk_base/modes/__init__.py", line 80, in
call
+ return mode.handler_function(*handler_args)
+ File "/omd/sites/stable/lib/python/cmk_base/modes/check_mk.py", line 366, in
mode_dump_agent
+ source_state, source_output, source_perfdata = source.get_summary_result()
+ File "/omd/sites/stable/lib/python/cmk_base/data_sources/abstract.py", line
392, in get_summary_result
+ return self._summary_result()
+ File "/omd/sites/stable/lib/python/cmk_base/data_sources/ipmi.py", line 152,
in _summary_result
+ return 0, "Version: %s" % self._get_ipmi_version(), []
+ File "/omd/sites/stable/lib/python/cmk_base/data_sources/ipmi.py", line 156,
in _get_ipmi_version
+ section = self._host_sections.sections.get("mgmt_ipmi_firmware")
+AttributeError: 'NoneType' object has no attribute 'sections'
+C-:
diff --git a/cmk_base/data_sources/abstract.py b/cmk_base/data_sources/abstract.py
index 595af9a..fa47bb7 100644
--- a/cmk_base/data_sources/abstract.py
+++ b/cmk_base/data_sources/abstract.py
@@ -116,25 +116,25 @@ class DataSource(object):
self._ipaddress = ipaddress
self._exception = None
- self._cmk_section = None
+ self._host_sections = None
try:
cpu_tracking.push_phase(self._cpu_tracking_id())
raw_data, is_cached_data = self._get_raw_data()
- if get_raw_data:
- return raw_data
- host_sections = self._convert_to_sections(raw_data)
+ self._host_sections = host_sections = self._convert_to_sections(raw_data)
assert isinstance(host_sections, HostSections)
+ if get_raw_data:
+ return raw_data
+
if host_sections.persisted_sections and not is_cached_data:
self._store_persisted_sections(host_sections.persisted_sections)
# Add information from previous persisted infos
host_sections = self._update_info_with_persisted_sections(host_sections)
- self._host_sections = host_sections
return host_sections
except MKTerminate:
diff --git a/cmk_base/data_sources/ipmi.py b/cmk_base/data_sources/ipmi.py
index e6e8fdb..2ebfee3 100644
--- a/cmk_base/data_sources/ipmi.py
+++ b/cmk_base/data_sources/ipmi.py
@@ -152,6 +152,9 @@ class IPMIManagementBoardDataSource(ManagementBoardDataSource,
CheckMKAgentDataS
def _get_ipmi_version(self):
+ if self._host_sections is None:
+ return "unknown"
+
section = self._host_sections.sections.get("mgmt_ipmi_firmware")
if not section:
return "unknown"