Module: check_mk
Branch: master
Commit: f282f3d808148024fe85796553a036196ddab453
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f282f3d8081480…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Feb 27 13:53:36 2014 +0100
Fix new regex feature in hosts
---
modules/check_mk.py | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 22b2d31..6df7f77 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1845,20 +1845,21 @@ def in_extraconf_hostlist(hostlist, hostname):
return True
# Allow negation of hostentry with prefix '!'
- elif hostentry[0] == '!':
- hostentry = hostentry[1:]
- negate = True
- # Allow regex with prefix '~'
- elif hostentry[0] == '~':
- hostentry = hostentry[1:]
- regex = True
+ else:
+ if hostentry[0] == '!':
+ hostentry = hostentry[1:]
+ negate = True
+ # Allow regex with prefix '~'
+ if hostentry[0] == '~':
+ hostentry = hostentry[1:]
+ regex = True
hostentry = strip_tags(hostentry)
if not regex and hostname == hostentry:
return not negate
# Handle Regex
elif re.match(hostentry, hostname):
- return True
+ return not negate
return False