Module: check_mk
Branch: master
Commit: 7472e890e8c6baa5c38e7db6e75539c7ac6817a5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7472e890e8c6ba…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Mar 21 07:55:09 2017 +0100
4507 FIX Non resolvable hosts may lead to config compilation error
When having hosts without host address configured and compiling
the config of the core while the host can not be resolved, this
may lead to an excception:
AttributeError: 'NoneType' object has no attribute 'strip'
This has been fixed now.
Change-Id: If1fab5d65ea22cfa45f292c41ea4edecdf381eec
---
.werks/4507 | 17 +++++++++++++++++
modules/check_mk.py | 4 ++++
2 files changed, 21 insertions(+)
diff --git a/.werks/4507 b/.werks/4507
new file mode 100644
index 0000000..c73777b
--- /dev/null
+++ b/.werks/4507
@@ -0,0 +1,17 @@
+Title: Non resolvable hosts may lead to config compilation error
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+Edition: cee
+State: unknown
+Version: 1.5.0i1
+Date: 1490079245
+
+When having hosts without host address configured and compiling
+the config of the core while the host can not be resolved, this
+may lead to an excception:
+
+AttributeError: 'NoneType' object has no attribute 'strip'
+
+This has been fixed now.
diff --git a/modules/check_mk.py b/modules/check_mk.py
index fc57835..bfa5907 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -2910,11 +2910,15 @@ def get_host_attributes(hostname, tags):
# Now lookup configured IP addresses
if is_ipv4_host(hostname):
attrs["_ADDRESS_4"] = ip_address_of(hostname, 4)
+ if attrs["_ADDRESS_4"] == None:
+ attrs["_ADDRESS_4"] = ""
else:
attrs["_ADDRESS_4"] = ""
if is_ipv6_host(hostname):
attrs["_ADDRESS_6"] = ip_address_of(hostname, 6)
+ if attrs["_ADDRESS_6"] == None:
+ attrs["_ADDRESS_6"] = ""
else:
attrs["_ADDRESS_6"] = ""