Module: check_mk
Branch: master
Commit: 573bb7b3cb1cd259ab9ff1182326567ab9728edf
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=573bb7b3cb1cd2…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Dec 21 08:27:54 2016 +0100
WATO: Cleaned up deprecated is_distributed() function
Change-Id: I52985e59bfd22b7b1a923eb17b2b7382ca0d6592
---
web/htdocs/wato.py | 40 ++++++++++++++++++----------------------
web/htdocs/watolib.py | 7 -------
web/plugins/userdb/ldap.py | 2 +-
web/plugins/visuals/wato.py | 3 +--
4 files changed, 20 insertions(+), 32 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 2402969..87b13f5 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -30,10 +30,6 @@
# and implement AJAX handlers. It uses classes, functions and globals
# from watolib.py.
-# CLEANUP: is_distributed() now always returns True. Remove all occurrances
-# of this function as soon as we know that everything still works without
-# the old "single" mode.
-
# .--README--------------------------------------------------------------.
# | ____ _ |
# | | _ \ ___ __ _ __| | _ __ ___ ___ |
@@ -7930,7 +7926,7 @@ def mode_user_notifications(phase, profilemode):
log_text = _("Deleted notification rule %d of user %s") % (nr,
userid)
notification_rule_start_async_repl = False
- if profilemode and is_distributed():
+ if profilemode and has_wato_slave_sites():
notification_rule_start_async_repl = True
log_audit(None, log_what, log_text)
else:
@@ -7953,7 +7949,7 @@ def mode_user_notifications(phase, profilemode):
log_text = _("Changed position of notification rule %d of user
%s") % (from_pos, userid)
notification_rule_start_async_repl = False
- if profilemode and is_distributed():
+ if profilemode and has_wato_slave_sites():
notification_rule_start_async_repl = True
log_audit(None, log_what, log_text)
else:
@@ -8052,7 +8048,7 @@ def mode_notification_rule(phase, profilemode):
log_text = _("Changed notification rule %d") % edit_nr + suffix
notification_rule_start_async_repl = False
- if profilemode and is_distributed():
+ if profilemode and has_wato_slave_sites():
notification_rule_start_async_repl = True
log_audit(None, log_what, log_text)
return # don't redirect to other page
@@ -8799,21 +8795,21 @@ def mode_sites(phase):
# will be removed.
test_sites = dict(configured_sites.items())
del test_sites[delid]
- if is_distributed(test_sites):
- # Make sure that site is not being used by hosts and folders
- if delid in Folder.root_folder().all_site_ids():
- search_url = html.makeactionuri([
- ("host_search_change_site", "on"),
- ("host_search_site", delid),
- ("host_search", "1"),
- ("folder", ""),
- ("mode", "search"),
- ("filled_in", "edit_host"),
- ])
- raise MKUserError(None,
- _("You cannot delete this connection. It has folders/hosts
"
- "assigned to it. You can use the <a
href=\"%s\">host "
- "search</a> to get a list of the hosts.") %
search_url)
+
+ # Make sure that site is not being used by hosts and folders
+ if delid in Folder.root_folder().all_site_ids():
+ search_url = html.makeactionuri([
+ ("host_search_change_site", "on"),
+ ("host_search_site", delid),
+ ("host_search", "1"),
+ ("folder", ""),
+ ("mode", "search"),
+ ("filled_in", "edit_host"),
+ ])
+ raise MKUserError(None,
+ _("You cannot delete this connection. It has folders/hosts
"
+ "assigned to it. You can use the <a
href=\"%s\">host "
+ "search</a> to get a list of the hosts.") %
search_url)
c = wato_confirm(_("Confirm deletion of site %s") % delid,
_("Do you really want to delete the connection to the
site %s?") % delid)
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 3e21cca..2b5ceb1 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -3510,13 +3510,6 @@ def do_remote_automation(site, command, vars):
return response
-# Determine, if we have any slaves to distribute
-# configuration to.
-def is_distributed(sites = None):
- # TODO: Remove all calls of this function
- return True
-
-
# Returns the ID of the default site. This is the site the main folder has
# configured by default. It inherits to all folders and hosts which don't have
# a site set on their own.
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index 0a48111..6dcf32a 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -1027,7 +1027,7 @@ class LDAPUserConnector(UserConnector):
pw_changed = True
# Synchronize new user profile to remote sites if needed
- if pw_changed and not changed and wato.is_distributed():
+ if pw_changed and not changed and wato.has_wato_slave_sites():
synchronize_profile_to_sites(self, user_id, user)
if changed:
diff --git a/web/plugins/visuals/wato.py b/web/plugins/visuals/wato.py
index 7e3c860..bbdd897 100644
--- a/web/plugins/visuals/wato.py
+++ b/web/plugins/visuals/wato.py
@@ -38,8 +38,7 @@ class FilterWatoFile(Filter):
# This filter is also available on slave sites with disabled WATO
# To determine if this site is a slave we check the existance of the
distributed_wato.mk
# file and the absence of any site configuration
- return (config.wato_enabled or\
- (not wato.is_distributed() and
os.path.exists(cmk.paths.check_mk_config_dir + "/distributed_wato.mk")))\
+ return (config.wato_enabled or wato.is_wato_slave_site())
def load_wato_data(self):