Module: check_mk
Branch: master
Commit: a4c1536a7a1fa1b0ea0b22e02d0373da4e4d1dbe
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a4c1536a7a1fa1…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Dec 7 14:30:44 2011 +0100
Distributed WATO: Fixed only_hosts file in distributed wato (basically reverts a
problematic fix which I can not remember the exact reason anymore)
---
web/htdocs/wato.py | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index df9c82d..532e50f 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -6414,7 +6414,7 @@ def update_only_hosts_file(sites):
distributed = True
if "socket" not in site \
or site["socket"] == "unix:" +
defaults.livestatus_unix_socket:
- create_only_hosts_file(siteid)
+ create_only_hosts_file(siteid, site.get("replication"))
if not distributed:
delete_only_hosts_file()
@@ -6965,7 +6965,7 @@ def automation_push_snapshot():
log_commit_pending() # pending changes are lost
# Create rule making this site only monitor our hosts
- create_only_hosts_file(site_id)
+ create_only_hosts_file(site_id, mode)
log_audit(None, "replication", _("Synchronized with master (my
site id is %s.)") % site_id)
if html.var("restart", "no") == "yes":
check_mk_local_automation("restart")
@@ -6977,14 +6977,17 @@ def automation_push_snapshot():
else:
return _("Internal automation error: %s") % e
-def create_only_hosts_file(siteid):
+def create_only_hosts_file(siteid, mode):
out = file(defaults.check_mk_configdir + "/only_hosts.mk", "w")
out.write("# Written by WATO\n# encoding: utf-8\n\n")
out.write("# This file has been created by the master site\n"
"# push the configuration to us. It makes sure that\n"
"# we only monitor hosts that are assigned to our site.\n\n")
out.write("if only_hosts == None:\n only_hosts = []\n\n")
- out.write("only_hosts += [(NEGATE, ['!site:%s'], ALL_HOSTS )]\n" %
siteid)
+ #if mode == 'master':
+ # out.write("only_hosts += [(NEGATE, ['!site:%s'], ALL_HOSTS
)]\n" % siteid)
+ #else:
+ out.write("only_hosts += [(['site:%s'], ALL_HOSTS )]\n" % siteid)
def delete_only_hosts_file():
p = defaults.check_mk_configdir + "/only_hosts.mk"