Module: check_mk
Branch: master
Commit: 45006cb8c21c0c4c181b98f97665354164017939
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=45006cb8c21c0c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Dec 15 11:13:52 2011 +0100
make host without site: belong to all sites
---
modules/check_mk.py | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/modules/check_mk.py b/modules/check_mk.py
index cd8b14e..b57ac2b 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -1085,9 +1085,8 @@ def filter_active_hosts(hostlist):
if only_hosts == None and distributed_wato_site == None:
return strip_tags(hostlist)
elif only_hosts == None:
- site_tag = "site:" + distributed_wato_site
return [ hostname for hostname in strip_tags(hostlist)
- if site_tag in tags_of_host(hostname) ]
+ if host_is_member_of_site(hostname, distributed_wato_site) ]
elif distributed_wato_site == None:
return [ hostname for hostname in strip_tags(hostlist)
if in_binary_hostlist(hostname, only_hosts) ]
@@ -1095,8 +1094,14 @@ def filter_active_hosts(hostlist):
site_tag = "site:" + distributed_wato_site
return [ hostname for hostname in strip_tags(hostlist)
if in_binary_hostlist(hostname, only_hosts)
- and site_tag in tags_of_host(hostname) ]
+ and host_is_member_of_site(hostname, distributed_wato_site) ]
+def host_is_member_of_site(hostname, site):
+ for tag in tags_of_host(hostname):
+ if tag.startswith("site:"):
+ return site == tag[5:]
+ # hosts without a site: tag belong to all sites
+ return True