Module: check_mk
Branch: master
Commit: 214a650973143c11a61607e5bf307e6575fc152f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=214a650973143c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Nov 12 10:04:08 2014 +0100
Allow hostname to be True in rule executor
---
modules/check_mk.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 51916c0..f37deaf 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1674,6 +1674,8 @@ def host_extra_conf(hostname, conf):
else:
raise MKGeneralException("Invalid entry '%r' in host
configuration list: must have 2 or 3 entries" % (entry,))
+ # Note: hostname may be True. This is an unknown generic host, that has
+ # no tags and that does not match any positive criteria in any rule.
if hosttags_match_taglist(tags_of_host(hostname), tags) and \
in_extraconf_hostlist(hostlist, hostname):
items.append(item)
@@ -1887,8 +1889,8 @@ def in_extraconf_hostlist(hostlist, hostname):
try:
if not use_regex and hostname == hostentry:
return not negate
- # Handle Regex
- elif use_regex and regex(hostentry).match(hostname):
+ # Handle Regex. Note: hostname == True -> generic unknown host
+ elif use_regex and hostname != True and regex(hostentry).match(hostname):
return not negate
except MKGeneralException:
if opt_debug: